You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#7940 (TypeScript 3.7 support) was closed as a dupe of #7431 (optional chaining and nullary coalescing support). However, TypeScript 3.7 had another syntax change that wasn't included in that: assertion functions. Unlike the other syntax changes, this isn't being standardized as part of regular JavaScript, which might be why there doesn't seem to be a Babel plugin for it.
I've been looking forward to using this feature. Will it be possible to support it in CRA?
Example Output
mkdir example;cd example;
npx create-react-app . --typescript;echo'function assertIsString(val: any): asserts val is string { if (typeof val !== "string") { throw new AssertionError("Not a string!"); }}'> src/App.tsx;
yarn build;
yarn run v1.17.3
$ react-scripts build
Creating an optimized production build...
=============
WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.2.1 <3.7.0
YOUR TYPESCRIPT VERSION: 3.7.2
Please only submit bug reports when using the officially supported version.
=============
Failed to compile.
./src/App.tsx
SyntaxError: /home/jeremy/example/src/App.tsx: Unexpected token, expected "{" (1:43)
> 1 | function assertIsString(val: any): asserts val is string {
| ^
2 | if (typeof val !== "string") {
3 | throw new AssertionError("Not a string!");
4 | }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The text was updated successfully, but these errors were encountered:
@ianschmitz look like both babel and typescript-eslint done with referenced PRs. Any updates for CRA?
We want to use assertion feature and AFAIK react-scripts is the last stopper.
#7940 (TypeScript 3.7 support) was closed as a dupe of #7431 (optional chaining and nullary coalescing support). However, TypeScript 3.7 had another syntax change that wasn't included in that: assertion functions. Unlike the other syntax changes, this isn't being standardized as part of regular JavaScript, which might be why there doesn't seem to be a Babel plugin for it.
I've been looking forward to using this feature. Will it be possible to support it in CRA?
Example Output
The text was updated successfully, but these errors were encountered: