You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this specific scenario, allowJs is enabled and react.d.ts is available. The React typings declares Component<P, S>. In a JavaScript file, a class is defined that extends React.Component, but without the generic arguments.
Expected behavior:
An ES6 class from './foo' that extends React.Component without generic arguments can be used in a .tsx file that imports it.
Actual behavior:
"[ts] Cannot use 'new' with an expression whose type lacks a call or construct signature." errors.
I think that this class should be automatically inferred to have extended React.Component<any, any>
The text was updated successfully, but these errors were encountered:
joelday
changed the title
When using allowJs, you are unable to use classes that do not extend a class in compliance with the declared type.
When using allowJs, you are unable to use classes that do not extend a declared class without including its generic type arguments.
Apr 8, 2017
TypeScript Version: 2.2.2
In this specific scenario, allowJs is enabled and react.d.ts is available. The React typings declares
Component<P, S>
. In a JavaScript file, a class is defined that extendsReact.Component
, but without the generic arguments.Code
foo.js:
bar.tsx:
Expected behavior:
An ES6 class from './foo' that extends
React.Component
without generic arguments can be used in a .tsx file that imports it.Actual behavior:
"[ts] Cannot use 'new' with an expression whose type lacks a call or construct signature." errors.
I think that this class should be automatically inferred to have extended
React.Component<any, any>
The text was updated successfully, but these errors were encountered: