Error message improvement for unexpected tokens in the following situations: * A word was parsed that seems to have a low edit distance from a known common keyword * A word was parsed that seems to be a known common keyword and a name _without_ a space in-between * Parsing in a particular type of node (mostly a class property declaration) got a different word or token than expected ___ * Specific diagnostic suggestions for unexpected keywords or identifier * Don't reach into there, that's not allowed * Improved error when there is already an initializer * Specific module error message for invalid template literal strings * Skip 'unexpected keyword or identifier' diagnostics for declare nodes * Improve error for function calls in type positions * Switch class properties to old diagnostic * Corrected errors in class members and reused existing textToKeywordObj map * Corrected more baselines from the merge * Update src/compiler/parser.ts Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com> * Mostly addressed feedback * Clarified function call type message * Split up and clarified parsing vs error functions * Swap interface name complaints back, and skip new errors on unknown (invalid) tokens * Used tokenToString, not a raw semicolon * Inline getExpressionText helper * Remove remarks in src/compiler/parser.ts Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
38 lines
2 KiB
Plaintext
38 lines
2 KiB
Plaintext
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(2,6): error TS2457: Type alias name cannot be 'any'.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(3,6): error TS2457: Type alias name cannot be 'number'.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(4,6): error TS2457: Type alias name cannot be 'boolean'.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(5,6): error TS2457: Type alias name cannot be 'string'.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,1): error TS2304: Cannot find name 'type'.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,6): error TS2457: Type alias name cannot be 'void'.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,11): error TS1109: Expression expected.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error TS2693: 'I' only refers to a type, but is being used as a value here.
|
|
tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(7,6): error TS2457: Type alias name cannot be 'object'.
|
|
|
|
|
|
==== tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts (9 errors) ====
|
|
interface I {}
|
|
type any = I;
|
|
~~~
|
|
!!! error TS2457: Type alias name cannot be 'any'.
|
|
type number = I;
|
|
~~~~~~
|
|
!!! error TS2457: Type alias name cannot be 'number'.
|
|
type boolean = I;
|
|
~~~~~~~
|
|
!!! error TS2457: Type alias name cannot be 'boolean'.
|
|
type string = I;
|
|
~~~~~~
|
|
!!! error TS2457: Type alias name cannot be 'string'.
|
|
type void = I;
|
|
~~~~
|
|
!!! error TS2304: Cannot find name 'type'.
|
|
~~~~
|
|
!!! error TS2457: Type alias name cannot be 'void'.
|
|
~
|
|
!!! error TS1109: Expression expected.
|
|
~
|
|
!!! error TS2693: 'I' only refers to a type, but is being used as a value here.
|
|
type object = I;
|
|
~~~~~~
|
|
!!! error TS2457: Type alias name cannot be 'object'.
|
|
|