accurate-environment-model
1
总安装量
1
周安装量
#46709
全站排名
安装命令
npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill accurate-environment-model
Agent 安装分布
mcpjam
1
openhands
1
replit
1
windsurf
1
zencoder
1
Skill 文档
Create an Accurate Model of Your Environment
Overview
Your TypeScript environment includes globals, environment variables, and platform-specific APIs. Create accurate type definitions for your environment using declaration files (.d.ts). This ensures type safety for platform-specific code and global variables.
When to Use This Skill
- Defining global types
- Augmenting window or globalThis
- Typing environment variables
- Working with build-time constants
- Configuring type definitions
The Iron Rule
Model your environment accurately with .d.ts files. Declare globals, window properties, and environment variables that your code depends on.
Example
// types/environment.d.ts
declare global {
interface Window {
APP_CONFIG: {
apiUrl: string;
version: string;
};
}
const BUILD_TIMESTAMP: number;
}
// Usage
console.log(window.APP_CONFIG.apiUrl);
console.log(BUILD_TIMESTAMP);
Reference
- Effective TypeScript, 2nd Edition by Dan Vanderkam
- Item 76: Create an Accurate Model of Your Environment