Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back from globalReadonlyArrayType to globalArrayType when transpiling #30734

Merged
merged 2 commits into from
Apr 4, 2019

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Apr 3, 2019

Syntax like ([''] as const).forEach or let x: readonly string[] implicitly references ReadonlyArray which isn't included when transpiling, so fall back to referencing the global Array type instead.

Fixes #30664

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, does this repro with a compiler test too, or does it require a unit test to trigger?

@andrewbranch
Copy link
Member Author

@sandersn I wasn't able to get it to repro with a compiler test, but in hindsight there was probably an option that does trigger it. I think I tried // @lib: [] but then later learned that // @noLib: true was probably the kicker.

@andrewbranch andrewbranch merged commit 8c51115 into microsoft:master Apr 4, 2019
@andrewbranch andrewbranch deleted the bug/30664 branch April 4, 2019 18:57
sqs added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this pull request Apr 7, 2019
Fix at microsoft/TypeScript#30734 for an issue with TypeScript 3.4.x and use of `readonly T[]`, which causes webpack to report the following error:

```
TypeError: Cannot read property 'instantiations' of undefined
```
sqs added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this pull request Apr 7, 2019
* upgrade to TypeScript 3.5.0 (dev) to fix `readonly` bug

Fix at microsoft/TypeScript#30734 for an issue with TypeScript 3.4.x and use of `readonly T[]`, which causes webpack to report the following error:

```
TypeError: Cannot read property 'instantiations' of undefined
```

* remove use of toString method on generic type parameter (TS 3.5 rejects it)

```
../shared/src/util/memoizeObservable.ts:37:58 - error TS2339: Property 'toString' does not exist on type 'P'.
         const key = resolver ? resolver(params) : params.toString()
```
andrewbranch added a commit to andrewbranch/TypeScript that referenced this pull request Apr 12, 2019
Fall back from `globalReadonlyArrayType` to `globalArrayType` when transpiling
RyanCavanaugh pushed a commit that referenced this pull request Apr 12, 2019
Fall back from `globalReadonlyArrayType` to `globalArrayType` when transpiling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants