-
Notifications
You must be signed in to change notification settings - Fork 13k
Declaration emit should avoid issuing errors on unresolved names #58536
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
Merged
weswigham
merged 3 commits into
microsoft:main
from
weswigham:declaration-emit-duplicated-errors
May 14, 2024
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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 hidden or 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
5 changes: 1 addition & 4 deletions
5
tests/baselines/reference/accessorDeclarationEmitVisibilityErrors.errors.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
accessorDeclarationEmitVisibilityErrors.ts(2,18): error TS2304: Cannot find name 'DoesNotExist'. | ||
accessorDeclarationEmitVisibilityErrors.ts(2,18): error TS4106: Parameter 'arg' of accessor has or is using private name 'DoesNotExist'. | ||
|
||
|
||
==== accessorDeclarationEmitVisibilityErrors.ts (2 errors) ==== | ||
==== accessorDeclarationEmitVisibilityErrors.ts (1 errors) ==== | ||
export class Q { | ||
set bet(arg: DoesNotExist) {} | ||
~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'DoesNotExist'. | ||
~~~~~~~~~~~~ | ||
!!! error TS4106: Parameter 'arg' of accessor has or is using private name 'DoesNotExist'. | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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
5 changes: 1 addition & 4 deletions
5
tests/baselines/reference/declarationEmitExpressionInExtends7.errors.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,11 +1,8 @@ | ||
declarationEmitExpressionInExtends7.ts(1,30): error TS2304: Cannot find name 'SomeUndefinedFunction'. | ||
declarationEmitExpressionInExtends7.ts(1,30): error TS4021: 'extends' clause of exported class has or is using private name 'SomeUndefinedFunction'. | ||
|
||
|
||
==== declarationEmitExpressionInExtends7.ts (2 errors) ==== | ||
==== declarationEmitExpressionInExtends7.ts (1 errors) ==== | ||
export default class extends SomeUndefinedFunction {} | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'SomeUndefinedFunction'. | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS4021: 'extends' clause of exported class has or is using private name 'SomeUndefinedFunction'. | ||
|
This file contains hidden or 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
5 changes: 1 addition & 4 deletions
5
tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,16 +1,13 @@ | ||
declarationEmitIndexTypeNotFound.ts(2,6): error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. | ||
declarationEmitIndexTypeNotFound.ts(2,13): error TS2304: Cannot find name 'TypeNotFound'. | ||
declarationEmitIndexTypeNotFound.ts(2,13): error TS4092: Parameter 'index' of index signature from exported interface has or is using private name 'TypeNotFound'. | ||
|
||
|
||
==== declarationEmitIndexTypeNotFound.ts (3 errors) ==== | ||
==== declarationEmitIndexTypeNotFound.ts (2 errors) ==== | ||
export interface Test { | ||
[index: TypeNotFound]: any; | ||
~~~~~ | ||
!!! error TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type. | ||
~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'TypeNotFound'. | ||
~~~~~~~~~~~~ | ||
!!! error TS4092: Parameter 'index' of index signature from exported interface has or is using private name 'TypeNotFound'. | ||
} | ||
|
This file contains hidden or 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
5 changes: 1 addition & 4 deletions
5
tests/baselines/reference/declarationEmitInvalidExport.errors.txt
This file contains hidden or 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 hidden or 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
8 changes: 1 addition & 7 deletions
8
tests/baselines/reference/declarationEmitLambdaWithMissingTypeParameterNoCrash.errors.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,20 +1,14 @@ | ||
declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(2,27): error TS2304: Cannot find name 'T2'. | ||
declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(2,27): error TS4016: Type parameter 'T1' of exported function has or is using private name 'T2'. | ||
declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(3,33): error TS2304: Cannot find name 'T2'. | ||
declarationEmitLambdaWithMissingTypeParameterNoCrash.ts(3,33): error TS4006: Type parameter 'T1' of constructor signature from exported interface has or is using private name 'T2'. | ||
|
||
|
||
==== declarationEmitLambdaWithMissingTypeParameterNoCrash.ts (4 errors) ==== | ||
==== declarationEmitLambdaWithMissingTypeParameterNoCrash.ts (2 errors) ==== | ||
export interface Foo { | ||
preFetch: <T1 extends T2> (c: T1) => void; // Type T2 is not defined | ||
~~ | ||
!!! error TS2304: Cannot find name 'T2'. | ||
~~ | ||
!!! error TS4016: Type parameter 'T1' of exported function has or is using private name 'T2'. | ||
preFetcher: new <T1 extends T2> (c: T1) => void; // Type T2 is not defined | ||
~~ | ||
!!! error TS2304: Cannot find name 'T2'. | ||
~~ | ||
!!! error TS4006: Type parameter 'T1' of constructor signature from exported interface has or is using private name 'T2'. | ||
} | ||
|
This file contains hidden or 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
5 changes: 1 addition & 4 deletions
5
tests/baselines/reference/declarationEmitMappedPrivateTypeTypeParameter.errors.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
/FromFactor.ts(2,15): error TS2304: Cannot find name 'StringKeyOf'. | ||
/FromFactor.ts(2,15): error TS4103: Type parameter 'TName' of exported mapped object type is using private name 'StringKeyOf'. | ||
|
||
|
||
==== /Helpers.ts (0 errors) ==== | ||
export type StringKeyOf<TObj> = Extract<string, keyof TObj>; | ||
|
||
==== /FromFactor.ts (2 errors) ==== | ||
==== /FromFactor.ts (1 errors) ==== | ||
export type RowToColumns<TColumns> = { | ||
[TName in StringKeyOf<TColumns>]: any; | ||
~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'StringKeyOf'. | ||
~~~~~~~~~~~ | ||
!!! error TS4103: Type parameter 'TName' of exported mapped object type is using private name 'StringKeyOf'. | ||
} |
This file contains hidden or 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
7 changes: 2 additions & 5 deletions
7
...aselines/reference/declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.errors.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,10 +1,7 @@ | ||
declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts(1,18): error TS2304: Cannot find name 'Unknown'. | ||
declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts(1,18): error TS4083: Type parameter 'T' of exported type alias has or is using private name 'Unknown'. | ||
|
||
|
||
==== declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts (2 errors) ==== | ||
==== declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts (1 errors) ==== | ||
type A<T extends Unknown> = {} | ||
~~~~~~~ | ||
!!! error TS2304: Cannot find name 'Unknown'. | ||
~~~~~~~ | ||
!!! error TS4083: Type parameter 'T' of exported type alias has or is using private name 'Unknown'. | ||
!!! error TS2304: Cannot find name 'Unknown'. |
This file contains hidden or 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
5 changes: 1 addition & 4 deletions
5
tests/baselines/reference/declarationEmitUnknownImport.errors.txt
This file contains hidden or 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 |
---|---|---|
@@ -1,17 +1,14 @@ | ||
declarationEmitUnknownImport.ts(1,1): error TS2303: Circular definition of import alias 'Foo'. | ||
declarationEmitUnknownImport.ts(1,14): error TS2304: Cannot find name 'SomeNonExistingName'. | ||
declarationEmitUnknownImport.ts(1,14): error TS2503: Cannot find namespace 'SomeNonExistingName'. | ||
declarationEmitUnknownImport.ts(1,14): error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'. | ||
|
||
|
||
==== declarationEmitUnknownImport.ts (4 errors) ==== | ||
==== declarationEmitUnknownImport.ts (3 errors) ==== | ||
import Foo = SomeNonExistingName | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2303: Circular definition of import alias 'Foo'. | ||
~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2304: Cannot find name 'SomeNonExistingName'. | ||
~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2503: Cannot find namespace 'SomeNonExistingName'. | ||
~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS4000: Import declaration 'Foo' is using private name 'SomeNonExistingName'. | ||
export {Foo} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Declaration emit errors are emitted in the presence of parse errors (unlike checker errors), so this (pretty bogus, given the parse error) error was here before, and now it's gone. If checker errors were reported, there would be one on
myClass
here, but, again, blocked by a parse error anyway.