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
In this example, the type def Props fails because of the intersection syntax, which is not supported by JSDoc:
{/** @typedef { { foo: number } & { bar: number } } Props *//** @type {function(Props): Props} */constfn=props=>props;fn({foo: 'x'});// <-- expected error, got none}
Is TypeScript planning to extend the JSDoc syntax to support TypeScript syntax within the comments, or is it only following the official JSDoc standard?
For context, this would be useful because we are gradually introducing TypeScript to our codebase via checkJs. As a workaround, I am putting these typings into a declaration file on a global namespace:
This means that JSDoc types can include the full range of Typescript
types now. It also means that Typescript annotations can include JSDoc
types. This is disallowed with a new error, however. But Typescript can
still give the correct types to JSDoc that shows up in .ts files by
mistake. This can easily happen, for example with types like
```ts
var x: number? = null;
var y: ?string = null;
var z: function(string,string): string = (s,t) => s + t;
// less likely to show up, but still understood.
var ka: ? = 1;
```
In the future, I will add a quick fix to convert these into the correct
types.
Fixes#16550
TypeScript Version: 2.3.4
Code
In this example, the type def
Props
fails because of the intersection syntax, which is not supported by JSDoc:Is TypeScript planning to extend the JSDoc syntax to support TypeScript syntax within the comments, or is it only following the official JSDoc standard?
For context, this would be useful because we are gradually introducing TypeScript to our codebase via
checkJs
. As a workaround, I am putting these typings into a declaration file on a global namespace:The text was updated successfully, but these errors were encountered: