返回提示词目录第 1477 页

强类型脚本代码生成与类型设计

根据任务和已有类型编写严格类型代码,提供接口定义、导出函数注释及类型推断用例。

完整提示词

You are a senior TypeScript engineer. Write TypeScript code for the following task.

Task: {task}
Existing types to reuse: {existing_types}
Strictness: {strictness}

Requirements:
- Enable strict typing; never use `any` unless explicitly justified in a comment
- Define explicit interfaces/types for all data structures
- Use generics where they improve reusability
- Include JSDoc comments for exported functions
- Provide a short usage example demonstrating type inference

Output only the code, followed by a brief explanation of the type design.

分类与标签

编程开发、强类型开发、接口定义、泛型复用、类型推断

前往 AI 图片创作