Skip to content

Typescript compiler crashes when mapped type uses unknown type #28927

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
lorefnon opened this issue Dec 9, 2018 · 3 comments
Closed

Typescript compiler crashes when mapped type uses unknown type #28927

lorefnon opened this issue Dec 9, 2018 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@lorefnon
Copy link

lorefnon commented Dec 9, 2018

TypeScript Version: 3.3.0-dev.20181208

Search Terms:
"type parameter: 181"

Code

export type Foo = {[I in (keyof Bar)]: Bar[I]} // Bar type is not defined

Expected behavior:
Compiler reports that Bar type is not defined

Actual behavior:
Compiler crashes and does not provide any information on what needs to be done to resolve the issue.

loref@DESKTOP-BBHGJ2D MINGW64 ~/Projects/ts-test (master)
$ yarn run tsc
yarn run v1.3.2
$ tsc
C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:71073
                throw e;
                ^

Error: Debug Failure. This is unknown parent for type parameter: 181
    at getTypeParameterConstraintVisibilityError (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:64666:37)
    at handleSymbolAccessibilityError (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:64792:33)
    at checkEntityNameVisibility (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:65116:13)
    at visitDeclarationSubtree (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:65262:25)
    at visitNode (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:53426:23)
    at Object.visitEachChild (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:53594:56)
    at visitDeclarationSubtree (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:65340:31)
    at visitNode (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:53426:23)
    at Object.visitEachChild (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:53592:57)
    at visitDeclarationSubtree (C:\Users\loref\Projects\ts-test\node_modules\typescript\lib\tsc.js:65340:31)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Playground Link: Not reproducible in playground

Related Issues:

@lorefnon
Copy link
Author

lorefnon commented Dec 9, 2018

A reproducer can be found in this repo: https://github.com/lorefnon/ts-issue-28927

@weswigham
Copy link
Member

Probably a duplicate of #25456

@weswigham weswigham added the Duplicate An existing issue was already created label Dec 10, 2018
@typescript-bot
Copy link
Collaborator

This issue has been marked as a duplicate and has seen no activity in the last day. It has been closed automatic house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants