This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Word | Deconstruction | |
|---|---|---|
| it's | it ~is | |
| years | year ~s | |
| going | go ~ing | |
| that's | that ~is | |
| i'm | i ~am | |
| things | thing ~s | |
| states | state ~s | |
| including | include ~ing | |
| called | call ~ed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print('Hello from testing.py') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Nullable<IdType, RequiredType> = RequiredType extends true ? IdType : IdType | null; | |
| export type SelectProps<IdType extends string, RequiredType extends boolean> = { | |
| options: Array<{id: IdType; name: string}>; | |
| selectedItemId: Nullable<IdType, RequiredType>; | |
| onSelect: (id: Nullable<IdType, RequiredType>) => void; | |
| required?: RequiredType; | |
| }; | |
| const Select = <IdType extends string, RequiredType extends boolean>( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Select | |
| selectedItemId={selectedItemId} | |
| onSelect={setSelectedItemId} | |
| options={[ | |
| {value: Size.Small, children: 'Small'}, | |
| {value: Size.Medium, children: 'Medium'}, | |
| {value: Size.Large, children: 'Large', disabled: true}, | |
| ]} | |
| required | |
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Nullable<IdType, RequiredType> = RequiredType extends true ? IdType : IdType | null; | |
| type OptionProps<IdType> = React.ComponentProps<'option'> & { | |
| value: IdType; | |
| }; | |
| const Select = <IdType extends string, RequiredType extends boolean>(props: { | |
| options: Array<OptionProps<IdType>>; | |
| selectedItemId: Nullable<IdType, RequiredType>; | |
| onSelect: (id: Nullable<IdType, RequiredType>) => void; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type BaseProps<IdType> = { | |
| options: Array<{id: IdType; name: string}>; | |
| }; | |
| type PropsWhenOptional<IdType> = BaseProps<IdType> & { | |
| required?: false; | |
| selectedItemId?: IdType | null; | |
| onSelect: (id: IdType | null) => void; | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const makeBigger = <T extends string | number>(stringOrNumber: T) => { | |
| if (typeof stringOrNumber === 'string') { | |
| return stringOrNumber.toUpperCase(); | |
| } | |
| return (stringOrNumber * 4); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const makeBigger = (stringOrNumber: string | number) => { | |
| if (typeof stringOrNumber === 'string') { | |
| return stringOrNumber.toUpperCase(); | |
| } | |
| return stringOrNumber * 4; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Nullable<IdType, RequiredType> = RequiredType extends true | |
| ? IdType | |
| : IdType | null; | |
| const Select = <IdType extends string, RequiredType extends boolean>(props: { | |
| options: Array<{id: IdType; name: string}>; | |
| selectedItemId: Nullable<IdType, RequiredType>; | |
| onSelect: (id: Nullable<IdType, RequiredType>) => void; | |
| required?: RequiredType; | |
| }) => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type BaseEntityWithFancyId<IdType> = { | |
| id: IdType; | |
| name: string; | |
| }; | |
| const Select = <IdType extends string>(props: { | |
| options: Array<BaseEntityWithFancyId<IdType>>; | |
| selectedItemId?: IdType; | |
| onSelect: (id: IdType) => void; | |
| }) => ( |