Skip to content

[@types/styled-components] React Native Project error on tsc (Type 'C' and exported member 'NonReactStatics') #46855

@Kojikun1

Description

@Kojikun1
  • I tried using the `@types/styled-components package and had problems.
  • I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • Mention the authors (see Definitions by: in index.d.ts) so they can respond.

the Error is this when i run tsc on React Native Project
compile normal the app runs great but with tsc get this errors
tested with the last version of typescript , and styled-compnents, i tried other versions but have the same error.

node_modules/@types/styled-components/ts3.7/index.d.ts:151:69 - error TS2694: Namespace '"C:/Users/bruno/desktop/authAppProject/AuthApp/node_modules/hoist-non-react-statics/index"' has no exported member 'NonReactStatics'.

151     string & StyledComponentBase<C, T, O, A> & hoistNonReactStatics.NonReactStatics<C extends React.ComponentType<any> ? C : never>;
                                                                        ~~~~~~~~~~~~~~~

node_modules/@types/styled-components/ts3.7/index.d.ts:170:39 - error TS2344: Type 'WithC' does not satisfy the constraint 'ComponentType<any>'.
  Type 'unknown' is not assignable to type 'ComponentType<any>'.
    Type 'unknown' is not assignable to type 'FunctionComponent<any>'.
      Type 'WithC' is not assignable to type 'FunctionComponent<any>'.
        Type 'unknown' is not assignable to type 'FunctionComponent<any>'.

170         StyledComponentInnerComponent<WithC>,
                                          ~~~~~

node_modules/@types/styled-components/ts3.7/index.d.ts:253:65 - error TS2344: Type 'C' does not satisfy the constraint 'ComponentType<any>'.
  Type 'ElementType<any>' is not assignable to type 'ComponentType<any>'.
    Type '"symbol"' is not assignable to type 'ComponentType<any>'.
      Type 'C' is not assignable to type 'FunctionComponent<any>'.
        Type 'ElementType<any>' is not assignable to type 'FunctionComponent<any>'.
          Type '"symbol"' is not assignable to type 'FunctionComponent<any>'.

253     ? React.ComponentPropsWithRef<StyledComponentInnerComponent<C>>
                                                                    ~

node_modules/@types/styled-components/ts3.7/index.d.ts:266:39 - error TS2344: Type 'C' does not satisfy the constraint 'ComponentType<any>'.
  Type 'unknown' is not assignable to type 'ComponentType<any>'.
    Type 'unknown' is not assignable to type 'FunctionComponent<any>'.
      Type 'C' is not assignable to type 'FunctionComponent<any>'.
        Type 'unknown' is not assignable to type 'FunctionComponent<any>'.

266         StyledComponentInnerComponent<C>,
                                          ~

node_modules/@types/styled-components/ts3.7/native.d.ts:40:39 - error TS2344: Type 'C' does not satisfy the constraint 'ComponentType<any>'.
  Type 'unknown' is not assignable to type 'ComponentType<any>'.
    Type 'unknown' is not assignable to type 'FunctionComponent<any>'.
      Type 'C' is not assignable to type 'FunctionComponent<any>'.
        Type 'unknown' is not assignable to type 'FunctionComponent<any>'.

40         StyledComponentInnerComponent<C>,
                                         ~


Found 6 errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions