jue-preset-typescript 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -0
- package/package.json +28 -0
- package/prompts/typescript/prompt.md +16 -0
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jue-preset-typescript",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript preset for ai-jue",
|
|
5
|
+
"files": [
|
|
6
|
+
"prompts",
|
|
7
|
+
"skills",
|
|
8
|
+
"index.js",
|
|
9
|
+
"META.json"
|
|
10
|
+
],
|
|
11
|
+
"keywords": [
|
|
12
|
+
"jue-preset"
|
|
13
|
+
],
|
|
14
|
+
"author": "AI-Jue Team <contact@ai-jue.dev>",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/ai-jue/ai-jue.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/ai-jue/ai-jue/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/ai-jue/ai-jue#readme",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"main": "index.js"
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
You are an expert in TypeScript.
|
|
3
|
+
|
|
4
|
+
# TypeScript Best Practices
|
|
5
|
+
|
|
6
|
+
1. **Strict Typing**: Always use strict typing. Avoid `any` whenever possible. Use `unknown` if the type is truly not known yet, and narrow it down.
|
|
7
|
+
2. **Type Inference**: Rely on type inference for simple variable initializations.
|
|
8
|
+
3. **Interfaces vs Types**: Use `interface` for defining public API shapes and object structures that might need extending. Use `type` for unions, intersections, and primitives.
|
|
9
|
+
4. **Generics**: Use generics to create reusable components and functions.
|
|
10
|
+
5. **Utility Types**: Make use of built-in utility types like `Partial<T>`, `Pick<T, K>`, `Omit<T, K>`, `Readonly<T>`.
|
|
11
|
+
6. **Async/Await**: Use `async/await` for asynchronous operations. Always type the return value of async functions as `Promise<T>`.
|
|
12
|
+
|
|
13
|
+
## Common Pitfalls
|
|
14
|
+
|
|
15
|
+
- Do not use `Function` type; use specific function signatures `() => void`.
|
|
16
|
+
- Avoid non-null assertion operator `!` unless you are 100% sure.
|