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

Upgrade to typescript 3.5.1 #6440

Merged
merged 3 commits into from May 31, 2019
Merged

Upgrade to typescript 3.5.1 #6440

merged 3 commits into from May 31, 2019

Conversation

jasongrout
Copy link
Contributor

References

Code changes

Upgrade to Typescript 3.5.1

User-facing changes

Backwards-incompatible changes

None, other than our dependencies change.

@jasongrout jasongrout added this to the 1.0 milestone May 30, 2019
@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

Thanks!

@blink1073
Copy link
Member

$ tsc -b
../fileeditor-extension/src/index.ts(237,7): error TS2322: Type 'string | number | boolean | number[]' is not assignable to type 'never'.
  Type 'string' is not assignable to type 'never'.
../notebook-extension/src/index.ts(602,7): error TS2322: Type 'string | number | boolean | number[]' is not assignable to type 'never'.
  Type 'string' is not assignable to type 'never'.
../notebook-extension/src/index.ts(612,7): error TS2322: Type 'string | number | boolean | number[]' is not assignable to type 'never'.
  Type 'string' is not assignable to type 'never'.
../notebook-extension/src/index.ts(622,7): error TS2322: Type 'string | number | boolean | number[]' is not assignable to type 'never'.
  Type 'string' is not assignable to type 'never'.
../terminal-extension/src/index.ts(120,7): error TS2322: Type 'JSONPrimitive' is not assignable to type 'never'.
  Type 'string' is not assignable to type 'never'.

@blink1073
Copy link
Member

blink1073 commented May 30, 2019

Uh oh, the Windows JS build succeeded but actually had the same error as above...

@jasongrout
Copy link
Contributor Author

jasongrout commented May 30, 2019

We are running into problems where we have the following pattern:

interface IMy {
  a: number;
  b: string;
  c: boolean;
}

let x: IMy = {
  a: 5,
  b: 'hello',
  c: true
};

Object.keys(x).forEach((k: keyof IMy) => {
  x[k] = 'a';
});

That assignment x[k] = 'a' works fine in TS 3.4, but TS 3.5 is smarter about the keyof union, and realizes that nothing could ever satisfy the type conditions for 'a' | 'b' | 'c' (which is the keyof type), so x[keyof x] is type never, so assigning something to it never works.

I think this is related to https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#fixes-to-unsound-writes-to-indexed-access-types

@jasongrout
Copy link
Contributor Author

Looks like the test failure is something to be fixed in ts-loader: TypeStrong/ts-loader#939, TypeStrong/ts-loader#942

@blink1073
Copy link
Member

I'd say wait for the patch release of ts-loader since it looks to be imminent.

@jasongrout
Copy link
Contributor Author

I'd say wait for the patch release of ts-loader since it looks to be imminent.

Yep, I was on the fence about changing this vs waiting for a ts-loader release. At least we'll see if there are any other issues.

This was causing some tests to fail with the ts 3.5.1 upgrade.
@jasongrout
Copy link
Contributor Author

Looks like the updated ts-loader made all of our tests happy now!

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@jasongrout
Copy link
Contributor Author

Thanks @vidartf and @blink1073 for the reviews.

@jasongrout jasongrout merged commit 0bf189b into jupyterlab:master May 31, 2019
@lock
Copy link

lock bot commented Aug 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related discussion.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 6, 2019
@jasongrout jasongrout added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants