Skip to content

Debug Failure when emitting declaration for unresolved type constraints #12326

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

Closed
HerringtonDarkholme opened this issue Nov 17, 2016 · 2 comments
Assignees
Labels
Bug A bug in TypeScript

Comments

@HerringtonDarkholme
Copy link
Contributor

TypeScript Version: nightly, --declaration

Code

// @declaration
type A<T extends Unknown> = {}

Expected behavior:
Report Cannot find name 'Unknown'

Actual behavior:

Debug Failure. This is unknown parent for type parameter.

N.B. the actual bug is much more subtle. I encounter this when a type alias is bound by a type imported from a library. The actual bug is a compiler crash.

@HerringtonDarkholme
Copy link
Contributor Author

The actual reproduction is here. https://github.com/HerringtonDarkholme/av-ts/tree/ts-crash.
git clone and npm install and npm run compile should reproduce.
The last commit introduces compiler crashes.

Error is Cannot read property 'flags' of undefined at getTargetSymbol.

@HerringtonDarkholme
Copy link
Contributor Author

HerringtonDarkholme commented Nov 17, 2016

Together with #12291, all bugs are related to declaration emitting. Maybe we can just skip declaration emitting if there is error in compiling? Since code failed to compile will hardly produce valid declaration.

@mhegazy mhegazy added the Bug A bug in TypeScript label Nov 18, 2016
@mhegazy mhegazy added this to the TypeScript 2.1.3 milestone Nov 18, 2016
sheetalkamat added a commit that referenced this issue Nov 18, 2016
Fixes for #12291 and  #12326: Declaration emit when there are errors in the source file
sheetalkamat added a commit that referenced this issue Nov 18, 2016
[Release 2.1] Fixes for #12291 and #12326: Declaration emit when there are errors in the source file
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants