Skip to content

Bump Typescript to 3.7.4 #899

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

Merged
merged 7 commits into from
Jan 10, 2020
Merged

Bump Typescript to 3.7.4 #899

merged 7 commits into from
Jan 10, 2020

Conversation

skylerjokiel
Copy link
Contributor

This is a new PR because we were blocked before by tslint, which was on a very old ts build) and it was easier to start over then merge in a month of changes. Thanks @tylerbutler for doing amazing work in December and moving us onto eslint 😄

3.7 has a bug around array types where it munges them if you use undefined, null or unknown. (Issue: 33752)[https://github.com/microsoft/TypeScript/issues/33752]. I reached out to Ryan Cavanaugh who's an EM on the TS team and he put it on the backlog to get it fixed for 3.8. Because we only only have once instance of it impacting us I think it's not too bad and I added a comment in that spot.

Original Comment

3.7 has added a few cool features that make life notably nicer.

Highlights

Optional Chaining

// Before
if (foo && foo.bar && foo.bar.baz) {
    // ...
}

// After-ish
if (foo?.bar?.baz) {
    // ...
}

Nullish Coalescing

let x = foo ?? bar();

Assertion Functions

function assertIsString(val: any): asserts val is string {
    if (typeof val !== "string") {
        throw new AssertionError("Not a string!");
    }
}
function yell(str: any) {
    assertIsString(str);

    // Now TypeScript knows that 'str' is a 'string'.

    return str.toUppercase();
    //         ~~~~~~~~~~~
    // error: Property 'toUppercase' does not exist on type 'string'.
    //        Did you mean 'toUpperCase'?
}

Build Changes

There are a bunch of changes to the tsc build with Project References that came in 3.0. This included --incremental.

With 3.7 they made this better by adding Build-Free Editing with Project Refrences. We haven't taken advantage of Project References yet but we might be able to offload some of our incremental build logic to tsc itself.

Entire list of thing can be found here:

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-6.html
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html

@skylerjokiel skylerjokiel merged commit 7b18eb5 into microsoft:master Jan 10, 2020
@skylerjokiel skylerjokiel deleted the typescript-3.7.3 branch January 10, 2020 22:29
jason-ha pushed a commit that referenced this pull request Jan 23, 2025
Bumps [@fluidframework/cell](https://github.com/microsoft/FluidFramework/tree/HEAD/packages/dds/cell) from 2.0.0-rc.3.0.0 to 2.0.0-rc.3.0.1.
- [Release notes](https://github.com/microsoft/FluidFramework/releases)
- [Changelog](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/cell/CHANGELOG.md)
- [Commits](https://github.com/microsoft/FluidFramework/commits/client_v2.0.0-rc.3.0.1/packages/dds/cell)

---
updated-dependencies:
- dependency-name: "@fluidframework/cell"
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

2 participants