Skip to content

Adds satisfies to the jsdoc reference #2914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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