Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Repository files navigation

Using Typescript Types with JSDoc

Experimentation repo for various ways to type react apps.

See ./src folder for examples

Globally enable TS checking

To enable TS to run everywhere use the js/ts.implicitProjectConfig.checkJS setting in your VScode workspace or user settings.

"js/ts.implicitProjectConfig.checkJs": true

Typescript ignore errors

Pro-tip: CLI tool to automatically add ignore comments

The //@ts-ignore tells TypeScript to ignore the TypeScript errors in the line following the comment.

function mapValues(object, mapFunction) {
  // @ts-ignore
  return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFunction(value)]))
}

This //@ts-expect-error will ignore any typechecking failures in the next line, but will fail the typecheck if there are no errors

function mapValues(object, mapFunction) {
  //@ts-expect-error
  return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, mapFunction(value)]))
}

Ignoring multiple lines

// @ts-ignore-start
// @ts-ignore-end

Nuclear option to disable in file

// @ts-nocheck

Examples

Resources & Articles

Tools

Doc parsers

Formatters

Conversion tools

Extra imported types

Doc Generators

Runtime type checkers

VScode extensions

Msc

Examples

Using test code for docs

About

Using JSDoc for Typescript Types

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.