buildo / react-components

Collection of general React components used in buildo projects.
http://react-components.buildo.io/
MIT License
157 stars 21 forks source link

#1430: proposal: stop pinning dependencies (closes #1430) #1431

Closed giogonzo closed 4 years ago

giogonzo commented 4 years ago

Closes #2520596

⚠️ The line above was added during the automatic migration of all github project issues to Kaiten. The old GH issue link is kept here for reference (it is now deprecated, continue follow the original issue on Kaiten).

Closes #1430

Test Plan

tests pass

giogonzo commented 4 years ago

@veej I updated the PR with a few more changes, not super-related: left inline comments where relevant.

Could you please take a second look?

giogonzo commented 4 years ago

the previous version should work fine

@veej I spent some time trying to keep defaultProps and make all the dtslint tests pass.. with no success. See my comment above, maybe I'll try again later.. not sure

veej commented 4 years ago

the previous version should work fine

@veej I spent some time trying to keep defaultProps and make all the dtslint tests pass.. with no success. See my comment above, maybe I'll try again later.. not sure

Ok :(

giogonzo commented 4 years ago

@veej I spent some more time on this, and I've come to the conclusion that defaultProps might not be working due tue a TS change/update. One more reason to not trust the feature for the future..

e.g. with this version of TS and the "old" static defaultProps, even in very simple cases such as:

<SingleDropdown
  isClearable
  options={["foo"]}
  value={"foo"}
  onChange={(_: string | null) => {}}
/>;

I get:

No overload matches this call.
  Overload 1 of 2, '(props: Readonly<Pick<Props<string>, string | number> & { flat?: boolean | undefined; innerRef?: ((ref: StateManager<string, Select<string>> | null) => void) | undefined; options: GroupedOptionsType<...> | OptionsType<...>; } & { ...; } & CreatableProps<...> & { ...; } & DefaultProps> | Readonly<...> | Readonly<...> | Readonly<...>): Dropdown<...>', gave the following error.
    Type '{ isClearable: true; options: string[]; value: string; onChange: (_: string | null) => void; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<Dropdown<string>> & Readonly<Pick<Props<string>, string | number> & ... 4 more ... & DefaultProps> & Readonly<...>) | (IntrinsicAttributes & ... 2 more ... & Readonly<...>) | (IntrinsicAttributes & ... 2 more ... & Readonly<...>) | (IntrinsicAttributes & ... 2 more ......'.
      Type '{ isClearable: true; options: string[]; value: string; onChange: (_: string | null) => void; }' is missing the following properties from type 'Readonly<Pick<Props<string>, string | number> & { flat?: boolean | undefined; innerRef?: ((ref: StateManager<string, Select<string>> | null) => void) | undefined; options: GroupedOptionsType<...> | OptionsType<...>; } & { ...; } & { ...; } & DefaultProps>': delimiter, size, isSearchable, menuPlacement
  Overload 2 of 2, '(props: (Pick<Props<string>, string | number> & { flat?: boolean | undefined; innerRef?: ((ref: StateManager<string, Select<string>> | null) => void) | undefined; options: GroupedOptionsType<...> | OptionsType<...>; } & { ...; } & CreatableProps<...> & { ...; } & DefaultProps) | (Pick<...> & ... 4 more ... & DefaultProps) | (Pick<...> & ... 3 more ... & DefaultProps) | (Pick<...> & ... 3 more ... & DefaultProps), context?: any): Dropdown<...>', gave the following error.
    Type '{ isClearable: true; options: string[]; value: string; onChange: (_: string | null) => void; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<Dropdown<string>> & Readonly<Pick<Props<string>, string | number> & ... 4 more ... & DefaultProps> & Readonly<...>) | (IntrinsicAttributes & ... 2 more ... & Readonly<...>) | (IntrinsicAttributes & ... 2 more ... & Readonly<...>) | (IntrinsicAttributes & ... 2 more ......'.
      Type '{ isClearable: true; options: string[]; value: string; onChange: (_: string | null) => void; }' is missing the following properties from type 'Readonly<Pick<Props<string>, string | number> & { flat?: boolean | undefined; innerRef?: ((ref: StateManager<string, Select<string>> | null) => void) | undefined; options: GroupedOptionsType<...> | OptionsType<...>; } & { ...; } & { ...; } & DefaultProps>': delimiter, size, isSearchable, menuPlacement

In the last commit, I'm adding the same treatment to MutltiDropdownWithSelectAll together with related dtslint tests

kanbanbot commented 4 years ago