mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-02 14:48:32 -05:00
Merge pull request #26817 from Microsoft/resolvingJsonModuleLikeJsExportsEqual
Use widened type and non fresh type when resolving json module
This commit is contained in:
@@ -5133,7 +5133,14 @@ namespace ts {
|
||||
// Handle export default expressions
|
||||
if (isSourceFile(declaration)) {
|
||||
const jsonSourceFile = cast(declaration, isJsonSourceFile);
|
||||
return jsonSourceFile.statements.length ? checkExpression(jsonSourceFile.statements[0].expression) : emptyObjectType;
|
||||
if (!jsonSourceFile.statements.length) {
|
||||
return emptyObjectType;
|
||||
}
|
||||
const type = getWidenedLiteralType(checkExpression(jsonSourceFile.statements[0].expression));
|
||||
if (type.flags & TypeFlags.Object) {
|
||||
return getRegularTypeOfObjectLiteral(type);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
if (declaration.kind === SyntaxKind.ExportAssignment) {
|
||||
return checkExpression((<ExportAssignment>declaration).expression);
|
||||
|
||||
Reference in New Issue
Block a user