This major release upgrades TypeScript from 3.5.3 to 4.8.4 (https://github.com/tensorflow/tfjs/pull/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.
```typescript
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`](https://www.typescriptlang.org/tsconfig#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).
Add repository metadata to the package.json files for the following packages:
* @tensorflow/tfjs-react-native
* @tensorflow/tfjs-layers
* @tensorflow/tfjs-data
* @tensorflow/tfjs-backend-wasm
Co-authored-by: Matthew Soulanille <msoulanille@google.com>
* Add ignore require fields for browser
* Update tfjs-react-native to 3.0.0
* Copy tfjs union in the react native demo
* Upgrade react-native to use tfjs 3.1.0
* Update react native peer dependencies
Updates the version tfjs-react-native is built against. tfjs 2.1.0 introduced a breaking change in a webgl_util function. We also will narrow the suggested peerDependency version to make it easier for users to know which version of tfjs has been tested against tfjs-react-native.
BUG
Adds functions for converting camera data to tensors for realtime use in model predictions.
Primary goal of this change is to enable real time use of camera data with models like posenet/bodypix etc.
DEV
Switch half the projects to Typescript 3.5.3 and add a lint rule `no-unnecessary-type-assertion` to align with the style guide at Google.
Notes:
- I'm only doing half the projects to make the PR smaller, and also avoid triggering a CI for all possible projects.
- Changing global `tslint.json` doesn't affect `tfjs-layers`, `tfjs-converter`, `tfjs-data` and `tfjs-node` yet, because they don't extend from the global `tslint.json`.
- An upcoming PR will upgrade the above-mentioned projects as well.
* fix tests add webgl backend prototype
* webgl path for ios
* save
* avoid shadowing global functions in clip
* upgrade tfjs version
* remove unused constant in shader compiler
* Merge branch 'master' into rn-webgl
* code review fixes
improve float texture download detection to include half float textures.
* save
* save
* remove warning as it makes tests noisy
consider refactoring this in another PR.
* Merge branch 'master' into rn-webgl
* revert settings update
* add comment
* save
* fix fetching of binary files
* save
* save
* have tests spy on platform.fetch
* Merge branch 'master' into rn-webgl
* code review fixes
* save
* Merge branch 'master' into rn-webgl
* fix lint errors
* code review fixes
INTERNAL
This adds an initial prototype of a platform for react native support. Initially it supports CPU backend execution and provides two IOHandlers for use with react-native.
It also changes adds headers to (http) weight requests in core so that we can better distinguish the desired return type.