-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fix: checkAliasSymbol crash when checking for @deprecated #42971
Merged
sandersn
merged 2 commits into
master
from
fix-checkAliasSymbol-crash-on-checking-deprecated
Feb 26, 2021
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//// [tests/cases/compiler/importPropertyFromMappedType.ts] //// | ||
|
||
//// [errors.d.ts] | ||
// #42957 | ||
|
||
export = createHttpError; | ||
declare const createHttpError: createHttpError.NamedConstructors; | ||
declare namespace createHttpError { | ||
type NamedConstructors = { [P in 'NotFound']: unknown;} | ||
} | ||
|
||
//// [main.ts] | ||
import { NotFound } from './errors' | ||
|
||
|
||
//// [main.js] | ||
"use strict"; | ||
exports.__esModule = true; |
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/importPropertyFromMappedType.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
=== tests/cases/compiler/errors.d.ts === | ||
// #42957 | ||
|
||
export = createHttpError; | ||
>createHttpError : Symbol(createHttpError, Decl(errors.d.ts, 3, 13), Decl(errors.d.ts, 3, 65)) | ||
|
||
declare const createHttpError: createHttpError.NamedConstructors; | ||
>createHttpError : Symbol(createHttpError, Decl(errors.d.ts, 3, 13), Decl(errors.d.ts, 3, 65)) | ||
>createHttpError : Symbol(createHttpError, Decl(errors.d.ts, 3, 13), Decl(errors.d.ts, 3, 65)) | ||
>NamedConstructors : Symbol(createHttpError.NamedConstructors, Decl(errors.d.ts, 4, 35)) | ||
|
||
declare namespace createHttpError { | ||
>createHttpError : Symbol(createHttpError, Decl(errors.d.ts, 3, 13), Decl(errors.d.ts, 3, 65)) | ||
|
||
type NamedConstructors = { [P in 'NotFound']: unknown;} | ||
>NamedConstructors : Symbol(NamedConstructors, Decl(errors.d.ts, 4, 35)) | ||
>P : Symbol(P, Decl(errors.d.ts, 5, 33)) | ||
} | ||
|
||
=== tests/cases/compiler/main.ts === | ||
import { NotFound } from './errors' | ||
>NotFound : Symbol(NotFound, Decl(main.ts, 0, 8)) | ||
|
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/importPropertyFromMappedType.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
=== tests/cases/compiler/errors.d.ts === | ||
// #42957 | ||
|
||
export = createHttpError; | ||
>createHttpError : createHttpError.NamedConstructors | ||
|
||
declare const createHttpError: createHttpError.NamedConstructors; | ||
>createHttpError : createHttpError.NamedConstructors | ||
>createHttpError : any | ||
|
||
declare namespace createHttpError { | ||
type NamedConstructors = { [P in 'NotFound']: unknown;} | ||
>NamedConstructors : NamedConstructors | ||
} | ||
|
||
=== tests/cases/compiler/main.ts === | ||
import { NotFound } from './errors' | ||
>NotFound : unknown | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// #42957 | ||
|
||
// @filename: errors.d.ts | ||
export = createHttpError; | ||
declare const createHttpError: createHttpError.NamedConstructors; | ||
declare namespace createHttpError { | ||
type NamedConstructors = { [P in 'NotFound']: unknown;} | ||
} | ||
|
||
// @filename: main.ts | ||
import { NotFound } from './errors' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our
every
helper doesn't handleundefined
? Most of our other array helpers treatundefined
as an empty array input. Maybe we should change the helper?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does handle
undefined
, butevery(undefined, _) ==> true
, and thenaddDeprecatedSuggestion
crashes on the next line.This fix is shorter than
target.declarations && every(target.declarations, ...
and uses the standard utility, so I think it's better.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pffffff okay. Yeah.