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
functionexample(){}example.isFoo=functionisFoo(value: string): asserts value is 'foo'{if(value!=='foo'){thrownewError('Not foo');}};example.isFoo('test');
Behavior with typescript@5.8
Run node_modules/.bin/tsc — no errors.
Behavior with tsgo
Run node_modules/.bin/tsgo — see:
demo.ts:9:1 - error TS2775: Assertions require every name in the call target to be declared with an explicit type annotation.
9 example.isFoo('test');
~~~~~~~~~~~~~
demo.ts:3:1 - 'isFoo' needs an explicit type annotation.
3 example.isFoo = function isFoo(value: string): asserts value is 'foo' {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 if (value !== 'foo') {
~~~~~~~~~~~~~~~~~~~~~~~~
...
6 }
~~~
7 };
~
Found 1 error in demo.ts:9