{"id":14384366,"url":"https://github.com/DavidWells/types-with-jsdocs","last_synced_at":"2025-08-23T17:31:50.875Z","repository":{"id":63967423,"uuid":"376332640","full_name":"DavidWells/types-with-jsdocs","owner":"DavidWells","description":"Using JSDoc for Typescript Types","archived":false,"fork":false,"pushed_at":"2024-04-16T23:11:16.000Z","size":772,"stargazers_count":251,"open_issues_count":2,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-17T10:05:30.396Z","etag":null,"topics":["example","jsdoc","types","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavidWells.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-12T16:09:56.000Z","updated_at":"2024-11-11T13:34:43.000Z","dependencies_parsed_at":"2023-01-14T16:45:40.559Z","dependency_job_id":"8bc1e91e-c808-4a1e-a984-c6a8f526af30","html_url":"https://github.com/DavidWells/types-with-jsdocs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidWells%2Ftypes-with-jsdocs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidWells%2Ftypes-with-jsdocs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidWells%2Ftypes-with-jsdocs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidWells%2Ftypes-with-jsdocs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavidWells","download_url":"https://codeload.github.com/DavidWells/types-with-jsdocs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230716484,"owners_count":18269771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example","jsdoc","types","typescript","typescript-library"],"created_at":"2024-08-28T18:01:20.222Z","updated_at":"2024-12-21T12:30:30.525Z","avatar_url":"https://github.com/DavidWells.png","language":"JavaScript","readme":"# Using Typescript Types with JSDoc\n\nExperimentation repo for various ways to type react apps.\n\nSee [./src](./src) folder for examples\n\n## Globally enable TS checking\n\nTo enable TS to run everywhere use the [`js/ts.implicitProjectConfig.checkJS`](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_type-checking-javascript) setting in your VScode workspace or user settings.\n\n```json\n\"js/ts.implicitProjectConfig.checkJs\": true\n```\n\n## Typescript ignore errors\n\n\u003e Pro-tip: [CLI tool to automatically add ignore comments](https://github.com/kawamataryo/suppress-ts-errors)\n\nThe `//@ts-ignore` tells TypeScript to ignore the TypeScript errors in the line following the comment.\n\n```js\nfunction mapValues(object, mapFunction) {\n  // @ts-ignore\n  return Object.fromEntries(Object.entries(object).map(([key, value]) =\u003e [key, mapFunction(value)]))\n}\n```\n\nThis `//@ts-expect-error` will ignore any typechecking failures in the next line, but will fail the typecheck if there are no errors\n\n```js\nfunction mapValues(object, mapFunction) {\n  //@ts-expect-error\n  return Object.fromEntries(Object.entries(object).map(([key, value]) =\u003e [key, mapFunction(value)]))\n}\n```\n\n[Ignoring multiple lines](https://github.com/Microsoft/TypeScript/issues/19573#issuecomment-457598978)\n\n```js\n// @ts-ignore-start\n// @ts-ignore-end\n```\n\n[Nuclear option to disable in file](https://github.com/Microsoft/TypeScript/issues/19573#issuecomment-924972932)\n\n```js\n// @ts-nocheck\n```\n\n## Examples\n\n- A bunch of examples https://github.com/voxpelli/types-in-js/discussions/11\n- https://github.com/wooorm/dead-or-alive/blob/main/lib/index.js\n- https://github.com/Rich-Harris/devalue\n- https://github.com/meduzen/datetime-attribute\n- https://github.com/geut/deluge/blob/main/src/deluge.js#L1-L29\n- [https://github.com/ds300/lazyrepo/](blob/main/src/manifest/ManifestConstructor.js)\n- [https://github.com/sveltejs/kit/](https://github.com/sveltejs/kit/blob/master/packages/kit/src/core/utils.js)\n\n## Resources \u0026 Articles\n\n- [JSDoc typings: all the benefits of TypeScript, with none of the drawbacks](https://gils-blog.tayar.org/posts/jsdoc-typings-all-the-benefits-none-of-the-drawbacks/) + [giltayar/jsdoc-typing](https://github.com/giltayar/jsdoc-typing)\n- [Tips and tricks for working with types in JavaScript. voxpelli/types-in-js](https://github.com/voxpelli/types-in-js/discussions)\n- [JSDoc Cheatsheet](https://devhints.io/jsdoc)\n- [JSDoc Cheatsheet and Type Safety Tricks on Joshua's Docs](https://docs.joshuatz.com/cheatsheets/js/jsdoc/)\n- [JSDoc Cheatsheet by Jacob Paris](https://www.jacobparis.com/blog/jsdoc-cheatsheet)\n- [jsdoc-examples: Examples of using JSDoc to document JavaScript](https://github.com/bradtraversy/jsdoc-examples)\n- [Documentation and JSDoc](https://www.balena.io/blog/open-source-guide-1-documentation-and-jsdoc/)\n- [brettz9/awesome-jsdoc: A list of awesome jsdoc tools, resources, etc.](https://github.com/brettz9/awesome-jsdoc)\n- [TSConfig.json reference](https://www.typescriptlang.org/tsconfig)\n- [Understand the use of JSDoc through code](https://github.com/chunjin666/jsdoc-learning)\n- [JSDoc \u0026 React. JSDoc is very versatile tool. It… | by Anton Krinitsyn | Medium](https://medium.com/@antonkrinitsyn/jsdoc-react-5e6c530880a0)\n- [jsdoc-templates-demo: demo of well-known jsdoc3 templates](https://github.com/cancerberoSgx/jsdoc-templates-demo) \u0026 [examples](https://cancerberosgx.github.io/jsdoc-templates-demo/demo/)\n- [Check your JS with TS](https://whistlr.info/2021/check-js-with-ts/)\n- [JSDoc \u0026 React](https://medium.com/@antonkrinitsyn/jsdoc-react-5e6c530880a0)\n- [TypeScript-JSDoc-Guides](https://gist.github.com/DeruiDENG/074b15de1ebc23ee8d307c14198c1231)\n- https://dev.to/t7yang/type-safety-in-javascript-with-jsdoc-and-vscode-1a28\n- https://medium.com/@antonkrinitsyn/jsdoc-generic-types-typescript-db213cf48640\n- [TypeScript without TypeScript -- JSDoc superpowers](https://fettblog.eu/typescript-jsdoc-superpowers/)\n- [BeyondCodeBootcamp/jsdoc-typescript-starter: getting the most from JSDoc + tsserver (Type Linting without TypeScript)](https://github.com/BeyondCodeBootcamp/jsdoc-typescript-starter)\n- https://github.com/simone-sanfratello/do-typescript-without-typescript + https://www.youtube.com/watch?v=xLDVfBUgD8U\n- [TypeScript Without Transpilation](https://incrementalelm.com/typescript-without-transpilation/)\n- [もう TypeScript の補助輪を外そう 明日は//@ts-check を使う](https://zenn.dev/asama/articles/0c66573e488b22)\n- [JSDoc: TypeScript inside JavaScript and not the other way around 🤯](https://www.codejam.info/2021/10/jsdoc-typescript-inside-javascript.html)\n- [Type Safe JavaScript with JSDoc](https://medium.com/@trukrs/type-safe-javascript-with-jsdoc-7a2a63209b76)\n- [switch to using the \"default export\" to appease tsserver](https://twitter.com/_beyondcode/status/1431105142888140802)\n- [Utilise JSDoc comment tags so that VSCode intellisense works great!](https://blog.shhdharmen.me/how-to-utilise-jsdoc-comment-tags-so-that-visual-studio-code-intellisense-works-great)\n- [JSDoc Crash Course 2021](https://codekila.com/jsdoc-crash-course-2021-javascript-documentation-generator/)\n- https://github.com/ipfs/aegir/blob/master/md/ts-jsdoc.md\n- [andreidmt/tpl-ts-jsdoc: Plain JavaScript with types by leveraging TypeScript's JSDoc support.](https://github.com/andreidmt/tpl-ts-jsdoc)\n- https://github.com/stereobooster/type-o-rama\n- [TypeScript Type Safety with AJV Standalone](https://rehanvdm.com/blog/typescript-type-safety-with-ajv-standalone) + https://github.com/rehanvdm/ajv-standalone-type-saftey\n- [Highest Voted 'jsdoc' Questions - Stack Overflow](https://stackoverflow.com/questions/tagged/jsdoc)\n- [Types in JavaScript With Zod and JSDoc](https://blog.jim-nielsen.com/2023/types-in-jsdoc-with-zod/)\n\n## Tools\n\n## Doc parsers\n\n- https://github.com/ccontrols/structured-types\n- https://github.com/yashag/jsdoctor/\n- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser\n- https://github.com/hegemonic/catharsis\n- https://github.com/jsdoctypeparser/jsdoctypeparser\n- https://github.com/reactjs/react-docgen\n- https://github.com/syavorsky/comment-parser\n- https://api-extractor.com/pages/tsdoc/tag_example/\n- https://github.com/eslint/doctrine\n- https://github.com/DavidWells/jsdoc-parser - Updated fork of dox\n- https://github.com/jonschlinkert/parse-comments Parse JavaScript code comments.\n- https://github.com/jonschlinkert/tokenize-comment\n- https://github.com/jsdoc2md/jsdoc-api - A programmatic interface for jsdoc3 with a few extra features\n\n## Formatters\n\n- [hosseinmd/prettier-plugin-jsdoc: A prettier plugin for formatting Jsdoc.](https://github.com/hosseinmd/prettier-plugin-jsdoc)\n- [Prettier for JSdoc](https://github.com/homer0/packages/tree/main/packages/public/prettier-plugin-jsdoc)\n\n## Conversion tools\n\n- https://transform.tools Transform lots of stuff!\n- https://github.com/vega/ts-json-schema-generator or https://github.com/horiuchi/dtsgenerator TypeScript d.ts file generator from JSON Schema file\n- https://github.com/YousefED/typescript-json-schema\n- https://github.com/LinbuduLab/json-to-type-graphql JSON / Object / Request ---\u003e TypeGraphQL Class!\n- https://github.com/develar/ts2jsdoc - Generate JSDoc from Typescript\n- Object to schema https://github.com/unjs/untyped\n- Generate TS types from SQL schema https://github.com/vramework/schemats\n- Generate TS types from JSON responses https://github.com/ThePrimeagen/undefined\n- https://github.com/rmp135/sql-ts Generate TypeScript interfaces from a SQL database.\n- OpenAPI to TS https://github.com/drwpow/openapi-typescript\n- Generate type.d from openapi spec https://github.com/sigoden/openapi/tree/main/packages/typegen-openapi\n- protocol buffer messages to TS https://github.com/thesayyn/protoc-gen-ts\n- Protobuff to JSON schema https://github.com/devongovett/protobuf-jsonschema\n- Convert TS to flow https://github.com/zxbodya/flowts/blob/master/packages/tsflow/src/convertToFlow.ts\n- Typescript for CSS modules https://github.com/mrmckeb/typescript-plugin-css-modules\n- JS doc to json schema https://github.com/brettz9/jsdoc-jsonschema\n- https://github.com/Surnet/swagger-jsdoc + https://github.com/ajmnz/swagger-jsdoc-indent - Generates swagger/openapi specification based on jsDoc comments and YAML files.\n- https://github.com/stereobooster/type-o-rama Directory of conversion tools\n- https://github.com/quicktype/quicktype - Generate types and converters from JSON, Schema, and GraphQL\n- [TS to JS with JSdoc](https://github.com/futurGH/ts-to-jsdoc)\n- [JSON to JSDoc](https://transform.tools/json-to-jsdoc)\n- https://github.com/unjs/untyped\n- GraphQL to JSONSchema https://github.com/charlypoly/graphql-to-json-schema\n- https://github.com/nijikokun/generate-schema Convert JSON Objects to MySQL, JSON Schema, Mongoose, Google BigQuery, Swagger\n- https://github.com/xiaobebe/extract-typescript-types\n\n## Extra imported types\n\n- https://github.com/ThomasAribart/json-schema-to-ts\n- https://github.com/krzkaczor/ts-essentials\n- https://github.com/millsp/ts-toolbelt\n- https://github.com/sindresorhus/type-fest\n- https://github.com/Col0ring/types-kit\n- https://github.com/alii/typestr\n- https://github.com/ghoullier/awesome-template-literal-types\n- https://github.com/jrylan/json-schema-typed JSON schema type\n- https://github.com/jrylan/http-method-enum HTTP methods as a TypeScript enum.\n- https://github.com/jrylan/enum-utils/\n- https://github.com/ronami/meta-typing\n- https://github.com/piotrwitek/utility-types\n- https://github.com/Lucifier129/coproduct\n- https://github.com/garronej/tsafe\n- https://github.com/g-plane/typed-query-selector typed `querySelector` and `querySelectorAll`\n- https://github.com/g-plane/type-gymnastics\n\n## Doc Generators\n\n- https://github.com/galvez/typejuice\n- https://github.com/jsdoc2md/jsdoc-to-markdown#readme\n- https://github.com/yashag/jsdoctor A smart jsdoc generator\n- https://github.com/documentationjs/documentation\n- https://github.com/DavidWells/microsoft-api-documenter-example using `@microsoft/api-extractor` + `@microsoft/api-documenter`\n- https://github.com/TypeStrong/typedoc + https://github.com/panva/oauth4webapi/blob/51866b3d65a7ac92a8811e26e55c320f4828a7fc/package.json#L25\n- https://github.com/LinusU/ts-readme-generator\n- https://github.com/marijnh/getdocs-ts + https://github.com/marijnh/builddocs\n\n## Runtime type checkers\n\n- https://github.com/moltar/typescript-runtime-type-benchmarks#packages-compared\n- https://github.com/David-Kunz/derive-type Derive types dynamically by running tests to capture value combinations\n- https://github.com/brielov/typed\n- https://github.com/grantila/typeconv for https://github.com/grantila/suretype\n- https://github.com/druc/intus\n- https://github.com/spaceteams/zap validation-first schema library with a functional api\n- https://github.com/colinhacks/zod/ + https://github.com/fabien0102/ts-to-zod + https://github.com/alii/azs\n- Tiny zod https://github.com/davidmdm/myzod\n- https://github.com/ianstormtaylor/superstruct\n- https://github.com/artalar/rtcad\n- https://github.com/skarab42/tson - Type Safe Object Notation \u0026 Validation\n- https://github.com/pelotom/runtypes\n- https://github.com/vedantroy/typecheck.macro\n- https://github.com/sindresorhus/is + https://github.com/sindresorhus/ts-extras\n- https://github.com/samchon/typescript-json Super-fast Runtime validator (type checker) with only one line\n- https://github.com/sindresorhus/ow\n- https://github.com/shigma/schemastery\n- https://github.com/justinyaodu/caketype\n- https://github.com/yona3/typescanner\n- https://github.com/rhys-vdw/ts-auto-guard\n- https://github.com/imbrn/v8n\n- https://github.com/d-kimuson/type-predicates-generator\n- https://github.com/milesj/optimal\n- https://github.com/jquense/yup\n- https://github.com/sideway/joi\n- https://github.com/drummer1992/sito\n- https://github.com/vitalets/micro-schema\n- https://github.com/daniel7grant/dvali\n- https://github.com/crinklesio/schemas\n- https://github.com/facebook/prop-types\n- https://github.com/elierotenberg/typed-assert\n- https://github.com/suchipi/serializable-types\n- https://github.com/gcanti/io-ts\n- https://github.com/thenativeweb/typedescriptor\n- https://github.com/thenativeweb/ensurethat\n- https://github.com/thenativeweb/formats\n- https://github.com/suchipi/pheno\n- https://github.com/markwylde/vamlid - A simple way to validate an object against a pure javascript schema.\n\n\n\n## VScode extensions\n\n- https://github.com/Perkovec/JSDocLivePreview\n- https://github.com/zachhardesty7/jsdoc-comment-toggler/blob/master/src/extension.ts\n\n## Msc\n\n- [@jitl/ts-simple-type](https://github.com/justjake/ts-simple-type) - provides a simple, type-safe API for analyzing types, constructing new types, and generating code based on types.\n- [typesync](https://github.com/jeffijoe/typesync) Install missing TypeScript typings for dependencies in your package.json.\n- [type-coverage](https://github.com/plantain-00/type-coverage) A CLI tool to check type coverage for typescript code\n- [typescript-error-reporter-action](https://github.com/Gozala/typescript-error-reporter-action) GitHub Action to diagnose TypeScript errors and report the result on PR.\n- A type detection utility for JavaScript https://github.com/sapphiredev/type / https://github.com/pkdev08/klasa-v13/blob/master/src/lib/util/Type.js\n- Zod to TS https://github.com/sachinraja/zod-to-ts\n- eslint config https://github.com/Agoric/agoric-sdk/blob/20c4ff00adbffff067858c3c5702ae7a9e0522b8/packages/eslint-config/eslint-config.json + https://github.com/homer0/packages/tree/main/packages/personal/eslint-plugin\n- https://github.com/benawad/gen-env-types - Generate a .d.ts and .env.example file from your .env file \n- Converts from JSON Schema to JSDoc https://github.com/n3ps/json-schema-to-jsdoc or https://github.com/mizuka-wu/json-schema-to-jsdoc/blob/master/src/plugins/jsonschema2jsdoc.js\n- https://github.com/livingdocsIO/microschema Small library without dependencies to create JSON Schemas.\n- https://github.com/stereobooster/type-o-rama\n- https://github.com/johnthecat/babel-plugin-jsdoc-runtime-typecheck/\n- https://github.com/heavenshell/ts-lehre\n- Clean theme https://github.com/cdaringe/jsdock\n- https://github.com/homer0/jsdoc-ts-utils/\n- https://github.com/vytenisu/npm-dts Generate index.d.ts file\n- Remove typescript types https://github.com/cyco130/detype\n- Babel traverse mobx to jsdoc https://github.com/Feverqwe/mst-jsdoc-gen/blob/master/getJsDoc.js\n- https://github.com/zacanger/jsdoctap Test runner for doctests using JSDoc examples and node-tap. or https://github.com/TechQuery/test-example/blob/master/source/TestFile.js OR https://github.com/kiwicopple/doctest-js\n- Tool to generate a single bundle of dts https://github.com/timocov/dts-bundle-generator\n- https://github.com/garbles/json-schema-multi-compiler\n- https://github.com/json-schema-faker/json-schema-faker\n- https://github.com/typescript-cheatsheets/react\n- https://github.com/gendocu-com/grpc-docs - Interactive gRPC API Documentation\n- https://github.com/2fd/graphtype Generate TypeScripts definitions from GraphQL\n- https://github.com/rawrmaan/restyped End-to-end typing for REST APIs with TypeScript\n- https://github.com/etienne-dldc/zensql A Typescript type-safe SQL system\n- https://github.com/Ff00ff/mammoth A type-safe Postgres query builder for TypeScript.\n- https://github.com/JoshuaKGoldberg/TypeStat Converts JavaScript to TypeScript and TypeScript to better TypeScript.\n- https://github.com/airtasker/spot Write API as code and generate other API contract formats (OpenAPI, Swagger, JSON Schema)\n- https://github.com/readmeio/oas Easily create and manage OpenAPI Documents via code comments\n- https://github.com/Akryum/vue-typegen scan components and generate types\n- https://github.com/deanshub/data-from-types generates data from TypeScript types\n- https://github.com/chasefleming/enum-xyz Enums in vanilla JS via proxy\n- https://github.com/apidoc/apidoc RESTful web API Documentation Generator.\n- https://github.com/twentyfourg/jest-apidoc Generate api docs from jest tests\n- https://github.com/thenativeweb/is-typescript Check if project is typescript\n- https://github.com/suchipi/convert-to-dts\n\n\n## Examples\n\n- https://github.com/Ethan-Arrowood/lego-world-map-designer/blob/main/index.js\n- https://gitlab.com/jugglinmike/friend-off/-/blob/main/src/server/room.js\n- https://github.com/Kr1an/react-jsdoc-sample + https://github.com/Kr1an/jsdoc-react-express-sample/blob/master/src/Single.js\n- https://github.com/wooorm/f-ck\n- https://github.com/micromark/micromark/blob/edbfa7a2d358d3264bd4524e947698cd7f7b480f/packages/micromark-util-types/index.js\n- https://github.com/fenomas/noa/blob/master/src/index.js\n- https://github.com/apollographql/apollo-server/issues/5097#issuecomment-822867819 + https://github.com/jaydenseric/graphql-upload/blob/master/package.json\n- https://github.com/MrShoenel/orchestration-tools + https://mrshoenel.github.io/orchestration-tools/\n- https://github.com/rubengomex/js-spotify-api/blob/master/src/index.js\n- https://github.com/homer0/parserror/blob/c12b20e3a321e1e01f41178eceb1d3210991d40f/src/parserror.js#L240\n- https://github.com/knockaway/loan-calculator/blob/master/lib/calculate-apr.js#L5-L19\n\n\n## Using test code for docs\n\n- https://github.com/linear/linear/blob/bc39d23af232f9fdbe7df458b0aaa9554ca83c57/packages/sdk/src/_tests/readme.test.ts#L57-L70 + https://github.com/linear/linear/blob/94af540244864fbe466fb933256278e04e87513e/docs/markdown-magic.config.js + https://github.com/linear/linear/blob/94af540244864fbe466fb933256278e04e87513e/docs/transforms/code-section.js\n- Pull in sub sections of markdown to other files https://github.com/linear/linear/blob/93981d3a3db571e2f8efdce9f5271ea678941c43/packages/codegen-doc/README.md#L32\n+ https://github.com/linear/linear/blob/93981d3a3db571e2f8efdce9f5271ea678941c43/docs/transforms/text-section.js + https://github.com/linear/linear/blame/bc39d23af232f9fdbe7df458b0aaa9554ca83c57/README.md#L42\n\n\n \n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDavidWells%2Ftypes-with-jsdocs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDavidWells%2Ftypes-with-jsdocs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDavidWells%2Ftypes-with-jsdocs/lists"}