Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix Route getComponent typing #246

Merged
merged 1 commit into from
Feb 25, 2019
Merged

fix: Fix Route getComponent typing #246

merged 1 commit into from
Feb 25, 2019

Conversation

taion
Copy link
Contributor

@taion taion commented Feb 25, 2019

No description provided.

) =>
| React.ComponentType<any>
| Promise<React.ComponentType<any>>
| Promise<JSX.Element>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am really confused how having an extra type in a union can make dtslint fail. but i do think this type is wrong

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't understand dtslint AT ALL. it also always uses tsc@next

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean this is a real error. i just have no idea how this caught it:

yarn run v1.13.0
$ dtslint types
Error: /Users/jjia/vendor/found/types/example-app/index.tsx:34:11
ERROR: 34:11  expect  TypeScript@next compile error:
Type '() => Promise<ComponentClass<any, any> | FunctionComponent<any> | Element | (() => Element)>' is not assignable to type '(match: RouteMatch) => ComponentClass<any, any> | FunctionComponent<any> | Promise<ComponentType<any>> | Promise<Element>'.
  Type 'Promise<ComponentClass<any, any> | FunctionComponent<any> | Element | (() => Element)>' is not assignable to type 'ComponentClass<any, any> | FunctionComponfix: Fix Route getComponent typing
ent<any> | Promise<ComponentType<any>> | Promise<Element>'.
    Type 'Promise<ComponentClass<any, any> | FunctionComponent<any> | Element | (() => Element)>' is not assignable to type 'Promise<ComponentType<any>>'.
      Type 'ComponentClass<any, any> | FunctionComponent<any> | Element | (() => Element)' is not assignable to type 'ComponentType<any>'.
        Type 'Element' is not assignable to type 'ComponentType<any>'.
          Type 'Element' is not assignable to type 'FunctionComponent<any>'.
            Type 'Element' provides no match for the signature '(props: any, context?: any): ReactElement<any> | null'.

@taion taion merged commit 03ae229 into master Feb 25, 2019
@taion taion deleted the fix-getComponent-type branch February 25, 2019 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants