Closed bluelovers closed 5 years ago
@ahejlsberg I investigated this: inside createArrayType
function on checker.ts, the variable globalReadonlyArrayType
is undefined as if its initialization cannot find the ReadonlyArray
declaration.
I cannot link to the lines because the file is too big for GitHub.
initialization cannot find the ReadonlyArray declaration.
That's kind of expected since there is no lib.xxx.d.ts
used by transpileModule
. Defining ReadonlyArray<T>
in the transpiled file should work around the crash.
This probably needs an additional condition to check if the global type is actually available. Though I don't know what a reasonable fallback would be.
Note that this might happen for globalArrayType
and friends.
I have this issue when using parcel to compile typescript files that use as const
syntax.
Seeing the same failure when applying readonly
to tuples like readonly [any, any]
I experience the same issue with typescript 3.4.1 while running ts.transpileModule
on the sample code for Improved support for read-only arrays and tuples
Error test code can be reduced to this:
function f2(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) {
}
Would you please release the fix as 3.4.x?
@andrewbranch please port the fix PR to the release-3.4 branch. Thanks!
Happened on (x: readonly T[])
Re-closing as this has been released
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
Code
Expected behavior:
Actual behavior:
Playground Link:
Related Issues: