<commit_before>---
id: 'typescript-config'
title: 'TypeScript Config'
---

This is a central reference for using Storybook with TypeScript.

## Typescript configuration presets

The easiest way to write and configure your stories in TypeScript is by using [Storybook presets](../../presets/introduction).

If you're using Create React App (CRA) and have configured it to work with TS, you should use the [CRA preset](https://github.com/storybookjs/presets/tree/master/packages/preset-create-react-app), which configures Storybook to reuse CRA's TS handling.

If you're not using CRA, the next best thing is to use the [Typescript preset](https://github.com/storybookjs/presets/tree/master/packages/preset-typescript), which configures `ts-loader` under the hood.

If you need more control than the TypeScript preset offers, read on for manual configuration instructions.

> If using TypeScript, some addons require features available in TS version 3.4+.
<commit_msg>Improve Typescript Configuration documentation page (#9617)<commit_after>---
id: 'typescript-config'
title: 'TypeScript Config'
---

This is a central reference for using Storybook with TypeScript.

## Typescript configuration presets

The fastest and easiest way to write and configure your stories in TypeScript is by using a Storybook preset.

* If you're using Create React App (CRA) and have configured it to work with TS, you should use [`@storybook/preset-create-react-app`](https://github.com/storybookjs/presets/tree/master/packages/preset-create-react-app), which configures Storybook to reuse CRA's TS handling.

* If you are not using CRA or have other requirements, then the next best option is [`@storybook/preset-typescript`](https://github.com/storybookjs/presets/tree/master/packages/preset-typescript), which configures `ts-loader` under the hood.

If you need more control than these presets offer, read on for manual configuration instructions.

You can learn more about Storybook presets [over here](../../presets/introduction).

> If using TypeScript, some addons require features available in TS version 3.4+.

{'fraction_non_alphanumeric': 0.08813720819437827, 'fraction_numerical': 0.003811338732729871, 'mean_word_length': 4.8171745152354575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6716955', 'n_tokens_mistral': 584, 'n_tokens_neox': 555, 'n_words': 242}