natysoz / expo-images-picker

Multiple Asset Photos Videos selecting package for Expo SDK
MIT License
95 stars 35 forks source link

Compile error #41

Closed zecergin closed 2 years ago

zecergin commented 2 years ago

For version 2.1.0, expo upgrades typescript to 4.3.5 which leads to have a problem on skipLibCheck and exclude. Therefore, I am having a compile error in node_modules/expo-images-picker/src/AssetsSelector.tsx:140:23 because getAssets = (first: number = 100) does not return a value for all paths.

That would be greate if you can help us on this.

Thanks.

natysoz commented 2 years ago

update to 2.1.2 and see if my recent commit fix ur issue please

zecergin commented 2 years ago

compile_errors Thank you for the update. Unfortunately, It returns more compile error now.

node_modules/expo-images-picker/src/AssetsSelector.tsx:140:23 - error TS7030: Not all code paths return a value.

140 const getAssets = (first: number) => {


**node_modules/expo-images-picker/src/AssetsSelector.tsx:269:42 - error TS2769: No overload matches this call.**
  Overload 1 of 2, '(props: Omit<Omit<ViewProps & RefAttributes<View> & IScreen, never> & Partial<Pick<ViewProps & RefAttributes<View> & IScreen, never>>, "theme"> & { ...; } & { ...; } & { ...; }): ReactElement<...>', gave the following error.
    Type 'number | undefined' is not assignable to type 'number'.
      Type 'undefined' is not assignable to type 'number'.
  Overload 2 of 2, '(props: StyledComponentPropsWithAs<typeof View, DefaultTheme, IScreen, never, typeof View, typeof View>): ReactElement<StyledComponentPropsWithAs<typeof View, ... 4 more ..., typeof View>, string | JSXElementConstructor<...>>', gave the following error.
    Type 'number | undefined' is not assignable to type 'number'.
      Type 'undefined' is not assignable to type 'number'.

269         <Screen bgColor={Styles.bgColor} borderRadius={Styles.borderRadius}>

node_modules/expo-images-picker/src/Types.ts:88:5 88 borderRadius: number

    The expected type comes from property 'borderRadius' which is declared here on type 'IntrinsicAttributes & Omit<Omit<ViewProps & RefAttributes<View> & IScreen, never> & Partial<Pick<ViewProps & RefAttributes<...> & IScreen, never>>, "theme"> & { ...; } & { ...; } & { ...; }'
  node_modules/expo-images-picker/src/Types.ts:88:5
    88     borderRadius: number
The expected type comes from property 'borderRadius' which is declared here on type 'IntrinsicAttributes & Omit<Omit<ViewProps & RefAttributes<View> & IScreen, never> & Partial<Pick<ViewProps & RefAttributes<...> & IScreen, never>>, "theme"> & { ...; } & { ...; } & { ...; }'

node_modules/expo-images-picker/src/AssetsSelector.tsx:293:18 - error TS2769: No overload matches this call. Overload 1 of 2, '(props: Omit<Omit<ViewProps & RefAttributes & IScreen, never> & Partial<Pick<ViewProps & RefAttributes & IScreen, never>>, "theme"> & { ...; } & { ...; } & { ...; }): ReactElement<...>', gave the following error. Property 'borderRadius' is missing in type '{ children: Element; bgColor: string; }' but required in type 'Omit<Omit<ViewProps & RefAttributes & IScreen, never> & Partial<Pick<ViewProps & RefAttributes & IScreen, never>>, "theme">'. Overload 2 of 2, '(props: StyledComponentPropsWithAs<typeof View, DefaultTheme, IScreen, never, typeof View, typeof View>): ReactElement<StyledComponentPropsWithAs<typeof View, ... 4 more ..., typeof View>, string | JSXElementConstructor<...>>', gave the following error. Property 'borderRadius' is missing in type '{ children: Element; bgColor: string; }' but required in type 'Omit<Omit<ViewProps & RefAttributes & IScreen, never> & Partial<Pick<ViewProps & RefAttributes & IScreen, never>>, "theme">'.

293


  node_modules/expo-images-picker/src/Types.ts:88:5
    88     borderRadius: number
'borderRadius' is declared here.

node_modules/expo-images-picker/src/Types.ts:88:5 88 borderRadius: number

    'borderRadius' is declared here.

**node_modules/expo-images-picker/src/AssetsSelector.tsx:304:21 - error TS2769: No overload matches this call.**
  Overload 1 of 2, '(props: Omit<Omit<ViewProps & RefAttributes<View> & IWidget, never> & Partial<Pick<ViewProps & RefAttributes<View> & IWidget, never>>, "theme"> & { ...; } & { ...; } & { ...; }): ReactElement<...>', gave the following error.
    Type 'number | undefined' is not assignable to type 'number'.
      Type 'undefined' is not assignable to type 'number'.
  Overload 2 of 2, '(props: StyledComponentPropsWithAs<typeof View, DefaultTheme, IWidget, never, typeof View, typeof View>): ReactElement<StyledComponentPropsWithAs<typeof View, ... 4 more ..., typeof View>, string | JSXElementConstructor<...>>', gave the following error.
    Type 'number | undefined' is not assignable to type 'number'.
      Type 'undefined' is not assignable to type 'number'.

304                     borderRadius={Styles.borderRadius}

node_modules/expo-images-picker/src/Types.ts:93:5 93 borderRadius: number

    The expected type comes from property 'borderRadius' which is declared here on type 'IntrinsicAttributes & Omit<Omit<ViewProps & RefAttributes<View> & IWidget, never> & Partial<Pick<ViewProps & RefAttributes<...> & IWidget, never>>, "theme"> & { ...; } & { ...; } & { ...; }'
  node_modules/expo-images-picker/src/Types.ts:93:5
    93     borderRadius: number
The expected type comes from property 'borderRadius' which is declared here on type 'IntrinsicAttributes & Omit<Omit<ViewProps & RefAttributes<View> & IWidget, never> & Partial<Pick<ViewProps & RefAttributes<...> & IWidget, never>>, "theme"> & { ...; } & { ...; } & { ...; }'

node_modules/expo-images-picker/src/AssetsSelector.tsx:310:25 - error TS2322: Type '(first: number) => Promise | undefined' is not assignable to type '() => void'.

310 getMoreAssets={getAssets}


  node_modules/expo-images-picker/src/Types.ts:154:5
    154     getMoreAssets(): void
The expected type comes from property 'getMoreAssets' which is declared here on type 'IntrinsicAttributes & AssetListPropTypes'

Found 5 errors.

natysoz commented 2 years ago

fix that on the last pr , give it a test and update me

zecergin commented 2 years ago

Screenshot from 2021-11-08 08-57-04

This should be the last one.

natysoz commented 2 years ago

i think its related to the noImplicitReturns ugly rule i add an extra empty return for the first if statement ,

lets see if the 2.2.1 fix that build issue , please update me after u try

natysoz commented 2 years ago

generally what happen is that your linting stage do not allow u to build , because the code is not passing "noImplicitReturns": true, you could

update to my last version where i extra add else with empty return just to skip this

or try turn off this rule on your tsconfig .

please update me when u got some results , thx

zecergin commented 2 years ago

Please see the pull request "Return always a value in function to satisfy 'noImplicitReturns' rule". It resolves the issue.

natysoz commented 2 years ago

ok thx @zecergin

natysoz commented 2 years ago

please update if v 2.2.3 fix this issue

zecergin commented 2 years ago

The issue is fixed, thank you.