mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 20:14:01 -06:00
Fix export default expression comment (#48323)
This commit is contained in:
parent
476fc625df
commit
0885482eeb
@ -1140,6 +1140,9 @@ namespace ts {
|
||||
const varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
|
||||
errorFallbackNode = undefined;
|
||||
const statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(SyntaxKind.DeclareKeyword)] : [], factory.createVariableDeclarationList([varDecl], NodeFlags.Const));
|
||||
|
||||
preserveJsDoc(statement, input);
|
||||
removeAllComments(input);
|
||||
return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
|
||||
}
|
||||
}
|
||||
|
||||
22
tests/baselines/reference/exportDefaultExpressionComments.js
Normal file
22
tests/baselines/reference/exportDefaultExpressionComments.js
Normal file
@ -0,0 +1,22 @@
|
||||
//// [exportDefaultExpressionComments.ts]
|
||||
/**
|
||||
* JSDoc Comments
|
||||
*/
|
||||
export default null
|
||||
|
||||
|
||||
//// [exportDefaultExpressionComments.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
/**
|
||||
* JSDoc Comments
|
||||
*/
|
||||
exports["default"] = null;
|
||||
|
||||
|
||||
//// [exportDefaultExpressionComments.d.ts]
|
||||
/**
|
||||
* JSDoc Comments
|
||||
*/
|
||||
declare const _default: any;
|
||||
export default _default;
|
||||
@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/declarationEmit/exportDefaultExpressionComments.ts ===
|
||||
/**
|
||||
No type information for this code. * JSDoc Comments
|
||||
No type information for this code. */
|
||||
No type information for this code.export default null
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/declarationEmit/exportDefaultExpressionComments.ts ===
|
||||
/**
|
||||
* JSDoc Comments
|
||||
*/
|
||||
export default null
|
||||
>null : null
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
// @declaration: true
|
||||
|
||||
/**
|
||||
* JSDoc Comments
|
||||
*/
|
||||
export default null
|
||||
Loading…
x
Reference in New Issue
Block a user