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

Can't call 'super' when extending from 'any' #17032

Closed
ghost opened this issue Jul 8, 2017 · 7 comments
Closed

Can't call 'super' when extending from 'any' #17032

ghost opened this issue Jul 8, 2017 · 7 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ghost
Copy link

ghost commented Jul 8, 2017

TypeScript Version: nightly (2.5.0-dev.20170707)

Code

declare const Super: any;
class C extends Super {
	constructor() {
		super();
	}
}

Expected behavior:

No error.

Actual behavior:

src/a.ts(4,3): error TS2346: Call target does not contain any signatures.

Ref: #14935, #14301

@vvkee
Copy link

vvkee commented Jul 26, 2017

How to solve

@ghost
Copy link
Author

ghost commented Jul 26, 2017

As a workaround, you could use class C extends (Super as { new(): any; }).

@mhegazy mhegazy added the Bug A bug in TypeScript label Aug 23, 2017
rugpanov added a commit to JetBrains/teamcity-vscode-extension that referenced this issue Dec 18, 2017
Use wrapper for win-credstore-parser,because Transform isn't injectable.
In previous implementation each entity was separated on lines but
currently we get chunks with all lines for each entity.
I have to extends Transform this way because of:
microsoft/TypeScript#17032
rugpanov added a commit to JetBrains/teamcity-vscode-extension that referenced this issue Dec 19, 2017
In previous implementation each entity was separated on lines but
currently we get chunks with all lines for each entity.
I have to extends Transform this way because of:
microsoft/TypeScript#17032
rugpanov pushed a commit to JetBrains/teamcity-vscode-extension that referenced this issue Dec 19, 2017
In previous implementation each entity was separated on lines but
currently we get chunks with all lines for each entity.
I have to extends Transform this way because of:
microsoft/TypeScript#17032
Use _final instead of _flush to avoid an error: stream.push() after EOF
rugpanov pushed a commit to JetBrains/teamcity-vscode-extension that referenced this issue Dec 19, 2017
In previous implementation each entity was separated on lines but
currently we get chunks with all lines for each entity.
I have to extends Transform this way because of:
microsoft/TypeScript#17032
Use _final instead of _flush to avoid an error: stream.push() after EOF
Add dependency injection for osx parse.
@sevenryze
Copy link

This form: class A extends ( React.component as { new(): any; } ) is not work. Is there any solution for it?

@ghost
Copy link
Author

ghost commented Jan 9, 2018

@sevenryze
You should be able to install @types/react, then import * as React from "react";. Then use React.Component instead of .component and it should be typed (and not need a cast).

@mhegazy mhegazy added this to the TypeScript 2.8 milestone Jan 9, 2018
@sevenryze
Copy link

@andy-ms yeh, I knew that way, that's works well.
But, for some reason, I want to just use the translate function of typescript(bypass the complex of typing system). So I expect a way to use plain JSX.
I see this issue is marked to bug and added to 2.8 milestone, that's good and I will wait for that time.
Anyway, thanks for your reply!

@ghost
Copy link
Author

ghost commented Jan 16, 2018

@sevenryze Actually, with "strict": false, I get no compile error from the following so long as I have react (not even @types/react) installed:

import * as React from "react";
class A extends (React.Component as { new(): any; }) {}

This is because without --noImplicitAny we allow you to import anything in your node_modules even if it lacks typings.

@sevenryze
Copy link

@andy-ms I try that again and confirm that what you told is works well. I think there maybe some config errors in my project and it's my mistake to not make sure of this problems.
Thanks for your answer, good job for TS team!

@mhegazy mhegazy modified the milestones: TypeScript 2.8, TypeScript 2.9 Mar 9, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 26, 2018
@mhegazy mhegazy closed this as completed Apr 26, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants