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 tfjs repo to 4.0.0 #6927

Merged
merged 7 commits into from Oct 12, 2022
Merged

Upgrade tfjs repo to 4.0.0 #6927

merged 7 commits into from Oct 12, 2022

Conversation

mattsoulanille
Copy link
Member

@mattsoulanille mattsoulanille commented Oct 11, 2022

This major release upgrades TypeScript from 3.5.3 to 4.8.4 (#6346). It is intended to be as non-breaking as possible, but it technically has breaking changes for users of typescript<4.4. All other users should be unaffected.

When compiling projects that depend on TFJS with typescript<4.4, the following error will appear.

node_modules/@webgpu/types/dist/index.d.ts:587:16 - error TS2304: Cannot find name 'PredefinedColorSpace'.

587   colorSpace?: PredefinedColorSpace;
                   ~~~~~~~~~~~~~~~~~~~~
...

This can be fixed by upgrading TypeScript to 4.4.2 or greater, or by adding the file predefined_color_space.d.ts (name and path can be changed) with the following contents to your project to define the missing type. If this file is added, it will need to be removed when TypeScript is upgraded past 4.3.

type PredefinedColorSpace = "display-p3" | "srgb";

typescript<3.7 has the following additional error.

node_modules/@tensorflow/tfjs-core/dist/engine.d.ts:127:9 - error TS1086: An accessor cannot be declared in an ambient context.

127     get backend(): KernelBackend;
            ~~~~~~~
...

Enabling skipLibCheck suppresses this error, and upgrading to at least TypeScript 3.6.2 fixes it (although the above fix for PredefinedColorSpace will also need to be applied).

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

Update TypeScript from 3.5.3 to 4.8.4.

Closes #5561, which has gone through review, but was not merged because of breaking changes introduced by typescript 4.4.2.
Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

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

Reviewed 55 of 55 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

Copy link
Collaborator

@lina128 lina128 left a comment

Choose a reason for hiding this comment

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

LGTM

Reviewable status: :shipit: complete! 2 of 1 approvals obtained

@mattsoulanille
Copy link
Member Author

Nightly passed

@mattsoulanille mattsoulanille merged commit 8571f49 into master Oct 12, 2022
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.

None yet

3 participants