mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
Merge pull request #30734 from andrewbranch/bug/30664
Fall back from `globalReadonlyArrayType` to `globalArrayType` when transpiling
This commit is contained in:
@@ -30307,7 +30307,7 @@ namespace ts {
|
||||
autoArrayType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
}
|
||||
|
||||
globalReadonlyArrayType = <GenericType>getGlobalTypeOrUndefined("ReadonlyArray" as __String, /*arity*/ 1);
|
||||
globalReadonlyArrayType = <GenericType>getGlobalTypeOrUndefined("ReadonlyArray" as __String, /*arity*/ 1) || globalArrayType;
|
||||
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
|
||||
globalThisType = <GenericType>getGlobalTypeOrUndefined("ThisType" as __String, /*arity*/ 1);
|
||||
|
||||
|
||||
@@ -445,5 +445,13 @@ var x = 0;`, {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
transpilesCorrectly("Supports readonly keyword for arrays", "let x: readonly string[];", {
|
||||
options: { compilerOptions: { module: ModuleKind.CommonJS } }
|
||||
});
|
||||
|
||||
transpilesCorrectly("Supports 'as const' arrays", `([] as const).forEach(k => console.log(k));`, {
|
||||
options: { compilerOptions: { module: ModuleKind.CommonJS } }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[].forEach(function (k) { return console.log(k); });
|
||||
//# sourceMappingURL=file.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
[].forEach(function (k) { return console.log(k); });
|
||||
//# sourceMappingURL=file.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
var x;
|
||||
//# sourceMappingURL=file.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
var x;
|
||||
//# sourceMappingURL=file.js.map
|
||||
Reference in New Issue
Block a user