Skip to content

Commit 0c7831d

Browse files
committed
Revert more
1 parent 81f6282 commit 0c7831d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,11 +2295,9 @@ namespace ts {
22952295
? Diagnostics._0_was_exported_here
22962296
: Diagnostics._0_was_imported_here;
22972297

2298-
// Non-null assertion is safe because `markSymbolOfAliasDeclarationIfTypeOnly` cannot return true
2299-
// for an ImportEqualsDeclaration without also being passed a defined symbol.
2300-
// `typeOnlyDeclaration.name` will be an Identifier for all valid cases, but may be undefined for
2301-
// invalid `export type * ...` syntax.
2302-
const name = unescapeLeadingUnderscores(tryCast(typeOnlyDeclaration.name, isIdentifier)?.escapedText ?? resolved!.escapedName);
2298+
// Non-null assertion is safe because the optionality comes from ImportClause,
2299+
// but if an ImportClause was the typeOnlyDeclaration, it had to have a `name`.
2300+
const name = unescapeLeadingUnderscores(typeOnlyDeclaration.name!.escapedText);
23032301
addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
23042302
}
23052303
}
@@ -2730,7 +2728,7 @@ namespace ts {
27302728
}
27312729

27322730
/** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */
2733-
function getTypeOnlyAliasDeclaration(symbol: Symbol): TypeOnlyCompatibleAliasDeclaration | NamespaceExport | ExportDeclaration | undefined {
2731+
function getTypeOnlyAliasDeclaration(symbol: Symbol): TypeOnlyCompatibleAliasDeclaration | undefined {
27342732
if (!(symbol.flags & SymbolFlags.Alias)) {
27352733
return undefined;
27362734
}

src/compiler/utilities.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6216,8 +6216,7 @@ namespace ts {
62166216
}
62176217

62186218
export function typeOnlyDeclarationIsExport(typeOnlyDeclaration: Node) {
6219-
const kind = typeOnlyDeclaration.kind;
6220-
return kind === SyntaxKind.ExportSpecifier || kind === SyntaxKind.NamespaceExport || kind === SyntaxKind.ExportDeclaration;
6219+
return typeOnlyDeclaration.kind === SyntaxKind.ExportSpecifier;
62216220
}
62226221

62236222
function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node: Node) {

0 commit comments

Comments
 (0)