Fix local and exported type alias merging (#36237)
* Fix local and exported type alias merging * Add baselines
This commit is contained in:
parent
82a3eb5b5f
commit
1d5749ef78
|
@ -29187,7 +29187,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
function checkExportsOnMergedDeclarations(node: Node): void {
|
||||
function checkExportsOnMergedDeclarations(node: Declaration): void {
|
||||
if (!produceDiagnostics) {
|
||||
return;
|
||||
}
|
||||
|
@ -32493,6 +32493,7 @@ namespace ts {
|
|||
checkGrammarDecoratorsAndModifiers(node);
|
||||
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
checkTypeParameters(node.typeParameters);
|
||||
checkSourceElement(node.type);
|
||||
registerForUnusedIdentifiersCheck(node);
|
||||
|
|
12
tests/baselines/reference/typeAliasesDoNotMerge.errors.txt
Normal file
12
tests/baselines/reference/typeAliasesDoNotMerge.errors.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
tests/cases/conformance/types/typeAliases/typeAliasesDoNotMerge.ts(1,13): error TS2395: Individual declarations in merged declaration 'A' must be all exported or all local.
|
||||
tests/cases/conformance/types/typeAliases/typeAliasesDoNotMerge.ts(2,6): error TS2395: Individual declarations in merged declaration 'A' must be all exported or all local.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeAliases/typeAliasesDoNotMerge.ts (2 errors) ====
|
||||
export type A = {}
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration 'A' must be all exported or all local.
|
||||
type A = {}
|
||||
~
|
||||
!!! error TS2395: Individual declarations in merged declaration 'A' must be all exported or all local.
|
||||
|
8
tests/baselines/reference/typeAliasesDoNotMerge.js
Normal file
8
tests/baselines/reference/typeAliasesDoNotMerge.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
//// [typeAliasesDoNotMerge.ts]
|
||||
export type A = {}
|
||||
type A = {}
|
||||
|
||||
|
||||
//// [typeAliasesDoNotMerge.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
7
tests/baselines/reference/typeAliasesDoNotMerge.symbols
Normal file
7
tests/baselines/reference/typeAliasesDoNotMerge.symbols
Normal file
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/types/typeAliases/typeAliasesDoNotMerge.ts ===
|
||||
export type A = {}
|
||||
>A : Symbol(A, Decl(typeAliasesDoNotMerge.ts, 0, 0))
|
||||
|
||||
type A = {}
|
||||
>A : Symbol(A, Decl(typeAliasesDoNotMerge.ts, 0, 0), Decl(typeAliasesDoNotMerge.ts, 0, 18))
|
||||
|
7
tests/baselines/reference/typeAliasesDoNotMerge.types
Normal file
7
tests/baselines/reference/typeAliasesDoNotMerge.types
Normal file
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/types/typeAliases/typeAliasesDoNotMerge.ts ===
|
||||
export type A = {}
|
||||
>A : import("tests/cases/conformance/types/typeAliases/typeAliasesDoNotMerge").A
|
||||
|
||||
type A = {}
|
||||
>A : import("tests/cases/conformance/types/typeAliases/typeAliasesDoNotMerge").A
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export type A = {}
|
||||
type A = {}
|
Loading…
Reference in a new issue