Skip to main content

3 posts tagged with "JSDoc"

Type safety through JSDoc annotations.

View All Tags

typescript-eslint with JSDoc JavaScript

· 12 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

It's possible to statically type check a JavaScript codebase with TypeScript with JSDoc annotations. Going a little further, and using typescript-eslint to lint your codebase with the benefits of type information can improve your code quality even more. This post will show you how to set this up and talk about some of the gotchas.

title image reading "typescript-eslint with JSDoc JavaScript" with a typescript-eslint logo and TypeScript logo

We'll also talk a little about how to use TypeScript in combination with JSDoc annotations in a JavaScript codebase.

Type annotations: strong types, weakly held

· 9 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

Recently, a new ECMAScript proposal called "Type Annotations" (originally named "Types as Comments") was revealed. The purpose is to allow type annotations to be valid JavaScript syntax. Albeit syntax that is ignored by JavaScript engines. The proposal is being worked on by Gil Tayar, Daniel Rosenwasser, Romulo Cintra, Rob Palmer, and others. Many of these people are from TypeScript community - however this proposal intentionally does not exist to benefit TypeScript alone.

TypeScript vs JSDoc JavaScript

· 6 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

There's a debate to be had about whether using JavaScript or TypeScript leads to better outcomes when building a project. The introduction of using JSDoc annotations to type a JavaScript codebase introduces a new dynamic to this discussion. This post will investigate what that looks like, and come to an (opinionated) conclusion.

title image reading "JSDoc JavaScript vs TypeScript" with a JavaScript logo and TypeScript logo

If you'd like to learn more about setting up a codebase to be type checked with JSDoc and TypeScript, then read this guide.