mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-23 07:07:09 -05:00
Fixed JSDoc get-only accessors to be serialized as const (#55444)
This commit is contained in:
committed by
GitHub
parent
f996bab056
commit
647c41d26e
@@ -9697,11 +9697,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? ModifierFlags.None : ModifierFlags.Export);
|
||||
}
|
||||
else {
|
||||
const flags = context.enclosingDeclaration?.kind === SyntaxKind.ModuleDeclaration && (!(symbol.flags & SymbolFlags.Accessor) || symbol.flags & SymbolFlags.SetAccessor) ? NodeFlags.Let : NodeFlags.Const;
|
||||
const statement = factory.createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
factory.createVariableDeclarationList([
|
||||
factory.createVariableDeclaration(varName, /*exclamationToken*/ undefined, serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled)),
|
||||
], context.enclosingDeclaration?.kind === SyntaxKind.ModuleDeclaration ? NodeFlags.Let : NodeFlags.Const),
|
||||
], flags),
|
||||
);
|
||||
// Inlined JSON types exported with [module.]exports= will already emit an export=, so should use `declare`.
|
||||
// Otherwise, the type itself should be exported.
|
||||
|
||||
Reference in New Issue
Block a user