-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Error TS2346 when importing React components written in JavaScript #15375
Comments
Covered by #5296 |
This is a very common pattern in React. For now we can import React from 'react';
export default class Component extends React.Component {
constructor(...args) {
// @ts-ignore
super(...args)
}
} |
It also seems that TypeScript ignores the good 'ol es5 spread pattern: A more complete demo:
|
Has this not been fixed or am I doing someting wrong? Just ran into this issue with typescript 2.9.1 public handleSpawnError(pythonCommand:string, pythonPath:string, err:string){
this.pythonPreview.handleSpawnError(...arguments)
// gives me error: Expected three arguments, but got 0 or more
} pythonPreview: public handleSpawnError(pythonCommand:string, pythonPath:string, err:string){
// ... code is irrelevant
} |
|
I couldn't find online any good solution to writing stuffs like:
Is there any update on a way to do this without having to do something ugly like:
|
TypeScript Version: 2.3.0
Code
See repo here: https://github.com/mohsen1/ts23-super-issue
Expected behavior:
No error
Actual behavior:
The text was updated successfully, but these errors were encountered: