ts-check-jsdoc-experiment

Enable TypeScript-style type checking in JavaScript files using JSDoc annotations.

Updated Jul 17, 2017
One-click install
npx skills add https://github.com/luyi985/lyi-bash --skill ts-check-jsdoc-experiment
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts-check-jsdoc-experiment
Source: https://github.com/luyi985/lyi-bash/tree/main/ai/skills/ts-check-jsdoc-experiment
Command: npx skills add https://github.com/luyi985/lyi-bash --skill ts-check-jsdoc-experiment

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This approach lets you add TypeScript-style static typing to JavaScript files without a full conversion, helping you catch type errors earlier and ease migration.

Core Features & Use Cases

  • Add @ts-check at the top of a JS file to enable type checking in editors and during builds.
  • Use JSDoc annotations to describe types, interfaces, and typedefs across modules.
  • Facilitate gradual migration by incrementally introducing types while preserving existing JS code.

Quick Start

Add // @ts-check at the top of a JavaScript file and begin annotating with JSDoc types.

Frequently Asked Questions about ts-check-jsdoc-experiment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable TypeScript type checking in plain JavaScript files?

To enable TypeScript type checking in plain JavaScript, add // @ts-check at the top of your JS file and use JSDoc annotations to define types. This allows editors and build tools to catch type errors without converting your codebase to TypeScript.

What is the best way to gradually migrate JavaScript to TypeScript?

Gradual migration to TypeScript is best achieved by using // @ts-check and JSDoc type annotations in existing JavaScript files. This approach incrementally introduces static typing to preserve your current code structure while catching type errors early during the transition.

Can I use JSDoc to define types across modules without converting to TypeScript?

Yes, you can use JSDoc to describe types, interfaces, and typedefs across JavaScript modules. By enabling // @ts-check, the TypeScript checker interprets these JSDoc annotations to provide static type validation directly within your plain JS files.

Does // @ts-check work with existing JavaScript build pipelines?

The // @ts-check directive works with existing JavaScript build pipelines and editors by enabling the TypeScript checker on plain JS files. It allows you to validate JSDoc type definitions during builds without requiring a full TypeScript compilation setup.

When should I avoid using JSDoc type annotations for JavaScript type checking?

You should avoid relying solely on JSDoc type annotations when your project requires complex TypeScript features beyond static typing, such as advanced generics or enums. This approach is designed for gradual migration and learning environments, not as a complete replacement for native TypeScript syntax.