Skip to content

Commit

Permalink
Adds satisfies to the jsdoc reference (#2914)
Browse files Browse the repository at this point in the history
  • Loading branch information
orta authored Aug 3, 2023
1 parent 3e1e8b9 commit dd8d1a3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/documentation/copy/en/javascript/JSDoc Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Note any tags which are not explicitly listed below (such as `@async`) are not y
- [`@typedef`](#typedef-callback-and-param)
- [`@callback`](#typedef-callback-and-param)
- [`@template`](#template)
- [`@satisfies`](#satisfies)


#### Classes

Expand Down Expand Up @@ -397,6 +399,29 @@ class Cache {
let c = new Cache()
```

### `@satisfies`

`@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.

```js twoslash
// @errors: 1360
/**
* @typedef {"hello world" | "Hello, world"} WelcomeMessage
*/

/** @satisfies {WelcomeMessage} */
const message = "hello world"
// ^?

/** @satisfies {WelcomeMessage} */
const failingMessage = "Hello world!"

/** @type {WelcomeMessage} */
const messageUsingType = "hello world"
// ^?
```


## Classes

Classes can be declared as ES6 classes.
Expand Down

0 comments on commit dd8d1a3

Please sign in to comment.