write-modern-javascript

Configure tsconfig.json targets and downleveling for modern JavaScript compatibility.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript projects often struggle to balance modern JavaScript features with compatibility targets. This Skill guides developers to write clean, future-proof code by choosing the right ES target, leveraging downleveling, and aligning TS features with runtime environments.

Core Features & Use Cases

  • Guidance on configuring tsconfig.json targets (ES2020+), module settings, and library options.
  • Recommendations for when to use modern JS features versus TS-specific constructs to optimize bundles and runtime performance.
  • Real-world scenario: upgrading a legacy codebase to modern syntax while maintaining compatibility across browsers.

Quick Start

Set your tsconfig target to ES2020, enable modern features, and rely on TypeScript downleveling for older environments.

Frequently Asked Questions about write-modern-javascript

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

FAQPage Schema
How do I use modern JavaScript features while maintaining browser compatibility?

TypeScript downleveling lets you write modern JavaScript while maintaining browser compatibility by compiling ES2020+ syntax to older targets. You set the target in tsconfig.json, and the TypeScript compiler handles the syntax transformation automatically.

What is the best way to configure tsconfig.json for ES2020 targets?

Configuring tsconfig.json for ES2020 targets involves setting the target property to ES2020, aligning module and library options with your runtime environment, and letting the TypeScript compiler manage compatibility through downleveling.

When do I need TypeScript downleveling for web development?

You need TypeScript downleveling for web development when your application must support older browsers or runtime environments that do not natively understand modern ES2020+ JavaScript features, ensuring broad compatibility without sacrificing modern syntax.

Can I upgrade a legacy codebase to modern syntax without breaking older browsers?

Yes, you can upgrade a legacy codebase to modern syntax without breaking older browsers by adopting ES2020+ features in your TypeScript code and relying on the compiler's downleveling capabilities to transpile the output for compatibility.

Why does choosing the right ES target improve code quality and build performance?

Choosing the right ES target improves code quality and build performance by aligning language features with runtime environments, reducing the need for unnecessary polyfills, and leveraging native JavaScript capabilities for optimized bundles.