Skip to content

Commit dd8d1a3

Browse files
authored
Adds satisfies to the jsdoc reference (#2914)
1 parent 3e1e8b9 commit dd8d1a3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/documentation/copy/en/javascript/JSDoc Reference.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Note any tags which are not explicitly listed below (such as `@async`) are not y
1919
- [`@typedef`](#typedef-callback-and-param)
2020
- [`@callback`](#typedef-callback-and-param)
2121
- [`@template`](#template)
22+
- [`@satisfies`](#satisfies)
23+
2224

2325
#### Classes
2426

@@ -397,6 +399,29 @@ class Cache {
397399
let c = new Cache()
398400
```
399401

402+
### `@satisfies`
403+
404+
`@satisfies` provides access to the postfix [operator `satisfies`](/docs/handbook/release-notes/typescript-4-9.html) in TypeScript. Satisfies is used to declare that a value implements a type but does not affect the type of the value.
405+
406+
```js twoslash
407+
// @errors: 1360
408+
/**
409+
* @typedef {"hello world" | "Hello, world"} WelcomeMessage
410+
*/
411+
412+
/** @satisfies {WelcomeMessage} */
413+
const message = "hello world"
414+
// ^?
415+
416+
/** @satisfies {WelcomeMessage} */
417+
const failingMessage = "Hello world!"
418+
419+
/** @type {WelcomeMessage} */
420+
const messageUsingType = "hello world"
421+
// ^?
422+
```
423+
424+
400425
## Classes
401426

402427
Classes can be declared as ES6 classes.

0 commit comments

Comments
 (0)