From 0356bccb7721039fc6f6412a497c19ff2a9f275c Mon Sep 17 00:00:00 2001 From: Kyle Gach Date: Thu, 11 Jan 2024 10:33:28 -0700 Subject: [PATCH] Add missing link --- docs/writing-stories/typescript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/writing-stories/typescript.md b/docs/writing-stories/typescript.md index da09837e9a74..2d64612c7f5e 100644 --- a/docs/writing-stories/typescript.md +++ b/docs/writing-stories/typescript.md @@ -55,7 +55,7 @@ For more information, please refer to [this discussion](https://github.com/story If you are using TypeScript 4.9+, you can take advantage of the new [`satisfies`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html) operator to get stricter type checking. Now you will receive type errors for missing required args, not just invalid ones. -Using `satisfies` to apply a story's type helps maintain type safety when sharing a `play` function across stories. Without it, TypeScript will throw an error that the `play` function may be undefined. The `satisfies` operator enables TypeScript to infer whether the play function is defined or not. +Using `satisfies` to apply a story's type helps maintain type safety when sharing a [play function](./play-function.md) across stories. Without it, TypeScript will throw an error that the `play` function may be undefined. The `satisfies` operator enables TypeScript to infer whether the play function is defined or not. Finally, use of `satisfies` allows you to pass `typeof meta` to the `StoryObj` generic. This informs TypeScript of the connection between the `meta` and `StoryObj` types, which allows it to infer the `args` type from the `meta` type. In other words, TypeScript will understand that args can be defined both at the story and meta level and won't throw an error when a required arg is defined at the meta level, but not at the story level.