Skip to content

TypeScript FAQ

zallen edited this page May 9, 2019 · 10 revisions

What is TypeScript?

TypeScript extends JavaScript with static typing. It can make code easier to understand and maintain by specifying properties and behavior more explicitly. It also improves the developer experience for consumers of our library through providing typings for other TypeScript projects.

Interfaces, classes, and enums allow you to define custom types that describe data structures and behavior. You can also share properties and behavior between different types via inheritance.

Need to learn TypeScript? Dive into the documentation or the useful links below.

Useful Links

Docs

There are common issues with the docs.

How do I get the TypeScript badge to show on the sidebar of the docs?

Include typescript: true in the frontmatter of the markdown.

Why aren't the props for my new component showing in the docs?

React-docgen cannot parse types outside of your component file. Move all types to that file. To debug prop errors, you can use this simple script:

const docgen = require('react-docgen');
const props = docgen.parse(`YOUR_COPY_PASTED_COMPONENT_FILE`, null, null, { filename: 'a.tsx' });
console.log(JSON.stringify(props, null, 2));