{"id":273,"date":"2026-10-03T10:53:45","date_gmt":"2026-10-03T02:53:45","guid":{"rendered":"https:\/\/yykcj.com\/?p=273"},"modified":"2026-10-03T10:53:45","modified_gmt":"2026-10-03T02:53:45","slug":"typescript-5-x-%e8%bf%9b%e9%98%b6%e7%94%a8%e6%b3%95%ef%bc%9a%e8%a3%85%e9%a5%b0%e5%99%a8%e3%80%81const-%e6%b3%9b%e5%9e%8b%e4%b8%8e-satisfies-%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/yykcj.com\/?p=273","title":{"rendered":"TypeScript 5.x \u8fdb\u9636\u7528\u6cd5\uff1a\u88c5\u9970\u5668\u3001const \u6cdb\u578b\u4e0e satisfies \u5b9e\u6218"},"content":{"rendered":"<h2>\u4e3a\u4ec0\u4e48 TypeScript 5.x \u503c\u5f97\u4f60\u91cd\u65b0\u5b66\u4e60\uff1f<\/h2>\n<p>TypeScript 5.0 \u4e8e 2023 \u5e74\u53d1\u5e03\uff0c\u5e26\u6765\u4e86\u88c5\u9970\u5668\u6807\u51c6\u3001<code>const<\/code> \u6cdb\u578b\u3001<code>satisfies<\/code> \u64cd\u4f5c\u7b26\u7b49\u91cd\u78c5\u7279\u6027\u3002\u5f88\u591a\u5f00\u53d1\u8005\u4ecd\u505c\u7559\u5728 <code>interface<\/code> + <code>\u6cdb\u578b<\/code> \u7684\u57fa\u7840\u7528\u6cd5\uff0c\u5374\u9519\u8fc7\u4e86\u8fd9\u4e9b\u80fd\u663e\u8457\u63d0\u5347\u4ee3\u7801\u8d28\u91cf\u4e0e\u5f00\u53d1\u4f53\u9a8c\u7684\u5229\u5668\u3002\u672c\u6587\u5c06\u5e26\u4f60\u4ece\u96f6\u5b9e\u8df5\u4e09\u4e2a\u8fdb\u9636\u7279\u6027\uff0c\u6bcf\u4e2a\u793a\u4f8b\u90fd\u5b8c\u6574\u53ef\u8fd0\u884c\uff0c\u5e76\u9644\u4e0a\u771f\u5b9e\u9879\u76ee\u4e2d\u7684\u8e29\u5751\u603b\u7ed3\u3002<\/p>\n<h2>\u73af\u5883\u51c6\u5907<\/h2>\n<p>\u786e\u4fdd\u4f60\u7684\u9879\u76ee\u4f7f\u7528 TypeScript 5.0 \u6216\u66f4\u9ad8\u7248\u672c\uff1a<\/p>\n<pre><code class=\"language-bash\">\nnpm install typescript@^5.4 --save-dev\n<\/code><\/pre>\n<p>\u5728 <code>tsconfig.json<\/code> \u4e2d\u5f00\u542f\u4e25\u683c\u6a21\u5f0f\uff08\u63a8\u8350\uff09\uff1a<\/p>\n<pre><code class=\"language-json\">\n{\n  &quot;compilerOptions&quot;: {\n    &quot;target&quot;: &quot;ES2022&quot;,\n    &quot;module&quot;: &quot;NodeNext&quot;,\n    &quot;strict&quot;: true,\n    &quot;experimentalDecorators&quot;: false,\n    &quot;emitDecoratorMetadata&quot;: false\n  }\n}\n<\/code><\/pre>\n<p>> \ud83d\udca1 \u6ce8\u610f\uff1aTypeScript 5.0 \u652f\u6301\u7684\u662f <strong>TC39 \u6807\u51c6\u88c5\u9970\u5668<\/strong>\uff0c\u4e0e\u65e7\u7248 <code>experimentalDecorators<\/code> \u4e0d\u540c\u3002\u82e5\u4f60\u4f7f\u7528 NestJS \u7b49\u6846\u67b6\uff0c\u53ef\u80fd\u9700\u8981\u4fdd\u7559 <code>experimentalDecorators: true<\/code>\uff0c\u4f46\u672c\u6587\u805a\u7126\u6807\u51c6\u88c5\u9970\u5668\u3002<\/p>\n<h2>\u4e00\u3001\u6807\u51c6\u88c5\u9970\u5668\uff1a\u66f4\u7b80\u6d01\u7684\u5143\u7f16\u7a0b<\/h2>\n<p>\u6807\u51c6\u88c5\u9970\u5668\u5141\u8bb8\u4f60\u4ee5\u58f0\u660e\u5f0f\u7684\u65b9\u5f0f\u4fee\u6539\u7c7b\u3001\u65b9\u6cd5\u3001\u8bbf\u95ee\u5668\u3001\u5c5e\u6027\u3002\u4e0e\u65e7\u7248\u76f8\u6bd4\uff0c\u5b83\u4e0d\u518d\u9700\u8981 <code>experimentalDecorators<\/code>\uff0c\u4e14\u7c7b\u578b\u63a8\u65ad\u66f4\u51c6\u786e\u3002<\/p>\n<h3>1.1 \u65b9\u6cd5\u88c5\u9970\u5668\uff1a\u81ea\u52a8\u65e5\u5fd7\u4e0e\u6027\u80fd\u76d1\u63a7<\/h3>\n<p>\u5047\u8bbe\u6211\u4eec\u8981\u4e3a\u5173\u952e\u65b9\u6cd5\u6dfb\u52a0\u6267\u884c\u65f6\u95f4\u65e5\u5fd7\u3002\u4f20\u7edf\u505a\u6cd5\u662f\u624b\u52a8\u5305\u88f9\uff0c\u73b0\u5728\u53ef\u4ee5\u7528\u88c5\u9970\u5668\uff1a<\/p>\n<pre><code class=\"language-typescript\">\nfunction logTime(target: any, context: ClassMethodDecoratorContext) {\n  const methodName = String(context.name);\n  return function (this: any, ...args: any[]) {\n    const start = performance.now();\n    const result = target.apply(this, args);\n    const end = performance.now();\n    console.log(`[${methodName}] \u6267\u884c\u8017\u65f6: ${(end - start).toFixed(2)}ms`);\n    return result;\n  };\n}\n\nclass DataService {\n  @logTime\n  fetchData(id: number) {\n    \/\/ \u6a21\u62df\u8017\u65f6\u64cd\u4f5c\n    const start = Date.now();\n    while (Date.now() - start &lt; 50) {}\n    return { id, data: &#x27;sample&#x27; };\n  }\n}\n\nconst service = new DataService();\nservice.fetchData(1);\n\/\/ \u8f93\u51fa: [fetchData] \u6267\u884c\u8017\u65f6: 50.12ms\n<\/code><\/pre>\n<p><strong>\u5173\u952e\u70b9<\/strong>\uff1a<\/p>\n<ul>\n<li><code>context.name<\/code> \u662f\u65b9\u6cd5\u540d\uff0c\u7c7b\u578b\u4e3a <code>string | symbol<\/code>\u3002<\/li>\n<li>\u8fd4\u56de\u7684\u65b0\u51fd\u6570\u4f1a\u66ff\u6362\u539f\u65b9\u6cd5\uff0c<code>this<\/code> \u6b63\u786e\u7ed1\u5b9a\u3002<\/li>\n<li>\u6807\u51c6\u88c5\u9970\u5668\u4e0d\u652f\u6301\u53c2\u6570\u88c5\u9970\u5668\uff0c\u5982\u9700\u53c2\u6570\u6821\u9a8c\u53ef\u7528\u5176\u4ed6\u65b9\u6848\u3002<\/li>\n<\/ul>\n<h3>1.2 \u7c7b\u88c5\u9970\u5668\uff1a\u81ea\u52a8\u6ce8\u518c\u8def\u7531<\/h3>\n<p>\u5728 Node.js \u540e\u7aef\u4e2d\uff0c\u6211\u4eec\u5e38\u7528\u7c7b\u88c5\u9970\u5668\u81ea\u52a8\u6ce8\u518c\u63a7\u5236\u5668\uff1a<\/p>\n<pre><code class=\"language-typescript\">\nconst routeRegistry: Record&lt;string, any&gt; = {};\n\nfunction Controller(basePath: string) {\n  return function &lt;T extends { new (...args: any[]): {} }&gt;(target: T, context: ClassDecoratorContext) {\n    const originalConstructor = target;\n    const className = context.name;\n    \n    \/\/ \u8fd4\u56de\u65b0\u7c7b\uff0c\u6ce8\u5165\u8def\u7531\u6ce8\u518c\u903b\u8f91\n    return class extends originalConstructor {\n      constructor(...args: any[]) {\n        super(...args);\n        \/\/ \u626b\u63cf\u539f\u578b\u65b9\u6cd5\u4e0a\u7684\u8def\u7531\u88c5\u9970\u5668\n        const methods = Object.getOwnPropertyNames(originalConstructor.prototype);\n        methods.forEach(method =&gt; {\n          if (method === &#x27;constructor&#x27;) return;\n          const route = Reflect.getMetadata(`route:${method}`, originalConstructor.prototype);\n          if (route) {\n            const fullPath = `${basePath}${route.path}`;\n            routeRegistry[fullPath] = (this as any)[method].bind(this);\n            console.log(`\u6ce8\u518c\u8def\u7531: ${route.method} ${fullPath}`);\n          }\n        });\n      }\n    };\n  };\n}\n\n\/\/ \u8f85\u52a9\u88c5\u9970\u5668\uff08\u7b80\u5316\u793a\u4f8b\uff0c\u5b9e\u9645\u9700\u7528 Reflect.metadata\uff09\nfunction Get(path: string) {\n  return function (target: any, context: ClassMethodDecoratorContext) {\n    Reflect.defineMetadata(`route:${String(context.name)}`, { method: &#x27;GET&#x27;, path }, target);\n  };\n}\n\n@Controller(&#x27;\/api&#x27;)\nclass UserController {\n  @Get(&#x27;\/users&#x27;)\n  getUsers() {\n    return [{ id: 1, name: &#x27;Alice&#x27; }];\n  }\n}\n\nnew UserController();\n\/\/ \u8f93\u51fa: \u6ce8\u518c\u8def\u7531: GET \/api\/users\n<\/code><\/pre>\n<p>> \ud83d\udca1 \u6ce8\u610f\uff1a\u6807\u51c6\u88c5\u9970\u5668\u4e0d\u76f4\u63a5\u63d0\u4f9b\u5143\u6570\u636e API\uff0c\u9700\u624b\u52a8\u5f15\u5165 <code>reflect-metadata<\/code> \u6216\u4f7f\u7528 WeakMap \u5b58\u50a8\u3002\u82e5\u9879\u76ee\u5df2\u7528\u65e7\u88c5\u9970\u5668\uff0c\u8fc1\u79fb\u9700\u8c28\u614e\u8bc4\u4f30\u3002<\/p>\n<h2>\u4e8c\u3001const \u6cdb\u578b\uff1a\u8ba9\u7c7b\u578b\u63a8\u65ad\u66f4\u7cbe\u786e<\/h2>\n<p><code>const<\/code> \u6cdb\u578b\u662f TypeScript 5.0 \u5f15\u5165\u7684\u8bed\u6cd5\uff0c\u5141\u8bb8\u6cdb\u578b\u53c2\u6570\u50cf <code>as const<\/code> \u4e00\u6837\u63a8\u65ad\u4e3a\u6700\u7a84\u7684\u5b57\u9762\u91cf\u7c7b\u578b\u3002<\/p>\n<h3>2.1 \u95ee\u9898\u573a\u666f\uff1a\u5143\u7ec4\u63a8\u65ad\u4e22\u5931<\/h3>\n<p>\u6ca1\u6709 <code>const<\/code> \u6cdb\u578b\u65f6\uff0c\u6570\u7ec4\u5b57\u9762\u91cf\u4f1a\u88ab\u63a8\u65ad\u4e3a <code>string[]<\/code>\uff0c\u4e22\u5931\u5143\u7ec4\u4fe1\u606f\uff1a<\/p>\n<pre><code class=\"language-typescript\">\nfunction createTuple&lt;T extends readonly any[]&gt;(items: T): T {\n  return items;\n}\n\nconst tuple1 = createTuple([&#x27;a&#x27;, &#x27;b&#x27;]); \/\/ \u7c7b\u578b: string[]\n\/\/ \u671f\u671b: readonly [&#x27;a&#x27;, &#x27;b&#x27;]\n<\/code><\/pre>\n<h3>2.2 \u4f7f\u7528 const \u6cdb\u578b<\/h3>\n<p>\u53ea\u9700\u5728\u6cdb\u578b\u53c2\u6570\u524d\u52a0 <code>const<\/code>\uff1a<\/p>\n<pre><code class=\"language-typescript\">\nfunction createTuple&lt;const T extends readonly any[]&gt;(items: T): T {\n  return items;\n}\n\nconst tuple2 = createTuple([&#x27;a&#x27;, &#x27;b&#x27;]); \/\/ \u7c7b\u578b: readonly [&#x27;a&#x27;, &#x27;b&#x27;]\n<\/code><\/pre>\n<p><strong>\u5b9e\u9645\u5e94\u7528\uff1a\u7c7b\u578b\u5b89\u5168\u7684\u8def\u7531\u5b9a\u4e49<\/strong><\/p>\n<pre><code class=\"language-typescript\">\ntype Route&lt;Path extends string, Method extends string&gt; = {\n  path: Path;\n  method: Method;\n};\n\nfunction defineRoute&lt;const T extends readonly Route&lt;string, string&gt;[]&gt;(routes: T): T {\n  return routes;\n}\n\nconst routes = defineRoute([\n  { path: &#x27;\/users&#x27;, method: &#x27;GET&#x27; },\n  { path: &#x27;\/users&#x27;, method: &#x27;POST&#x27; },\n]);\n\/\/ routes \u7c7b\u578b: readonly [{ path: &#x27;\/users&#x27;; method: &#x27;GET&#x27;; }, { path: &#x27;\/users&#x27;; method: &#x27;POST&#x27;; }]\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5728\u540e\u7eed\u4ee3\u7801\u4e2d\uff0c<code>routes[0].method<\/code> \u7684\u7c7b\u578b\u662f <code>'GET'<\/code> \u800c\u975e <code>string<\/code>\uff0c\u53ef\u4ee5\u7528\u4e8e\u6761\u4ef6\u7c7b\u578b\u6216\u6620\u5c04\u7c7b\u578b\u3002<\/p>\n<p>> \ud83d\udca1 \u6ce8\u610f\uff1a<code>const<\/code> \u6cdb\u578b\u53ea\u5f71\u54cd\u63a8\u65ad\uff0c\u4e0d\u5f71\u54cd\u8fd0\u884c\u65f6\u3002\u5bf9\u4e8e\u5bf9\u8c61\u5b57\u9762\u91cf\uff0c\u5b83\u4f1a\u4f7f\u5c5e\u6027\u53d8\u4e3a <code>readonly<\/code>\uff0c\u82e5\u9700\u53ef\u53d8\u8bf7\u663e\u5f0f\u6807\u6ce8\u3002<\/p>\n<h2>\u4e09\u3001satisfies \u64cd\u4f5c\u7b26\uff1a\u517c\u987e\u7c7b\u578b\u68c0\u67e5\u4e0e\u63a8\u65ad<\/h2>\n<p><code>satisfies<\/code> \u5141\u8bb8\u4f60\u9a8c\u8bc1\u8868\u8fbe\u5f0f\u662f\u5426\u7b26\u5408\u67d0\u4e2a\u7c7b\u578b\uff0c\u540c\u65f6\u4fdd\u7559\u8868\u8fbe\u5f0f\u6700\u5177\u4f53\u7684\u7c7b\u578b\u3002<\/p>\n<h3>3.1 \u4f20\u7edf\u75db\u70b9\uff1a\u7c7b\u578b\u6ce8\u89e3\u4e22\u5931\u5177\u4f53\u4fe1\u606f<\/h3>\n<pre><code class=\"language-typescript\">\ntype Colors = Record&lt;string, string | [number, number, number]&gt;;\n\nconst palette: Colors = {\n  red: &#x27;#ff0000&#x27;,\n  green: [0, 255, 0],\n};\n\n\/\/ palette.red \u7684\u7c7b\u578b\u662f string | [number, number, number]\n\/\/ \u65e0\u6cd5\u76f4\u63a5\u8c03\u7528 string \u65b9\u6cd5\n<\/code><\/pre>\n<h3>3.2 \u4f7f\u7528 satisfies<\/h3>\n<pre><code class=\"language-typescript\">\nconst palette = {\n  red: &#x27;#ff0000&#x27;,\n  green: [0, 255, 0],\n} satisfies Colors;\n\n\/\/ palette.red \u7684\u7c7b\u578b\u662f string\n\/\/ palette.green \u7684\u7c7b\u578b\u662f [number, number, number]\nconsole.log(palette.red.toUpperCase()); \/\/ \u5408\u6cd5\n<\/code><\/pre>\n<p><strong>\u5b9e\u9645\u5e94\u7528\uff1a\u914d\u7f6e\u5bf9\u8c61\u6821\u9a8c<\/strong><\/p>\n<pre><code class=\"language-typescript\">\ntype Config = {\n  apiUrl: string;\n  timeout: number;\n  retries: number;\n};\n\nconst config = {\n  apiUrl: &#x27;https:\/\/api.example.com&#x27;,\n  timeout: 5000,\n  retries: 3,\n} satisfies Config;\n\n\/\/ config.apiUrl \u7c7b\u578b\u662f string\uff0c\u4f46\u66f4\u7cbe\u786e\u7684\u662f\u5b57\u9762\u91cf\u7c7b\u578b\uff1f\n\/\/ \u5b9e\u9645\u4e0a satisfies \u4e0d\u4f1a\u6536\u7a84\u5230\u5b57\u9762\u91cf\uff0c\u9664\u975e\u914d\u5408 as const\nconst config2 = {\n  apiUrl: &#x27;https:\/\/api.example.com&#x27;,\n  timeout: 5000,\n  retries: 3,\n} as const satisfies Config;\n\/\/ config2.apiUrl \u7c7b\u578b: &#x27;https:\/\/api.example.com&#x27;\n<\/code><\/pre>\n<p>> \ud83d\udca1 \u6ce8\u610f\uff1a<code>satisfies<\/code> \u4e0d\u6539\u53d8\u8fd0\u884c\u65f6\u884c\u4e3a\uff0c\u5b83\u53ea\u662f\u7f16\u8bd1\u65f6\u68c0\u67e5\u3002\u4e0e <code>as const<\/code> \u7ed3\u5408\u65f6\uff0c\u6ce8\u610f\u987a\u5e8f\uff1a<code>as const satisfies Config<\/code> \u5148\u65ad\u8a00\u518d\u68c0\u67e5\u3002<\/p>\n<h2>\u56db\u3001\u7efc\u5408\u5b9e\u6218\uff1a\u7c7b\u578b\u5b89\u5168\u7684\u4e8b\u4ef6\u7cfb\u7edf<\/h2>\n<p>\u5c06\u4e09\u4e2a\u7279\u6027\u7ed3\u5408\uff0c\u6784\u5efa\u4e00\u4e2a\u7c7b\u578b\u5b89\u5168\u7684\u4e8b\u4ef6\u53d1\u5c04\u5668\uff1a<\/p>\n<pre><code class=\"language-typescript\">\ntype EventMap = {\n  login: { userId: string; timestamp: number };\n  logout: { userId: string };\n  error: { message: string; code: number };\n};\n\nclass TypedEventEmitter&lt;const T extends Record&lt;string, any&gt;&gt; {\n  private listeners: { [K in keyof T]?: Array&lt;(payload: T[K]) =&gt; void&gt; } = {};\n\n  on&lt;K extends keyof T&gt;(event: K, listener: (payload: T[K]) =&gt; void) {\n    if (!this.listeners[event]) {\n      this.listeners[event] = [];\n    }\n    this.listeners[event]!.push(listener);\n  }\n\n  emit&lt;K extends keyof T&gt;(event: K, payload: T[K]) {\n    this.listeners[event]?.forEach(listener =&gt; listener(payload));\n  }\n}\n\n\/\/ \u4f7f\u7528 const \u6cdb\u578b\u786e\u4fdd\u4e8b\u4ef6\u540d\u548c\u8d1f\u8f7d\u7c7b\u578b\u7cbe\u786e\nconst emitter = new TypedEventEmitter&lt;{\n  login: { userId: string; timestamp: number };\n  logout: { userId: string };\n  error: { message: string; code: number };\n}&gt;();\n\nemitter.on(&#x27;login&#x27;, (payload) =&gt; {\n  console.log(payload.userId, payload.timestamp); \/\/ \u7c7b\u578b\u5b89\u5168\n});\n\nemitter.emit(&#x27;login&#x27;, { userId: &#x27;u1&#x27;, timestamp: Date.now() });\n\/\/ emitter.emit(&#x27;login&#x27;, { userId: &#x27;u1&#x27; }); \/\/ \u9519\u8bef\uff1a\u7f3a\u5c11 timestamp\n<\/code><\/pre>\n<p><strong>\u7ed3\u5408\u88c5\u9970\u5668\u81ea\u52a8\u6ce8\u518c\u4e8b\u4ef6\u76d1\u542c<\/strong>\uff08\u7565\uff0c\u53ef\u6269\u5c55\uff09\u3002<\/p>\n<h2>\u5e38\u89c1\u5751\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h2>\n<ol>\n<li><strong>\u88c5\u9970\u5668\u8fc1\u79fb<\/strong>\uff1a\u65e7\u9879\u76ee\u5347\u7ea7\u5230\u6807\u51c6\u88c5\u9970\u5668\u65f6\uff0c\u53c2\u6570\u88c5\u9970\u5668\u4e0d\u53ef\u7528\u3002\u82e5\u5fc5\u987b\u4f7f\u7528\uff0c\u53ef\u6682\u65f6\u4fdd\u7559 <code>experimentalDecorators<\/code>\uff0c\u4f46\u65b0\u4ee3\u7801\u5efa\u8bae\u7528\u6807\u51c6\u88c5\u9970\u5668\u3002<\/li>\n<li><strong>const \u6cdb\u578b\u4e0e\u53ef\u53d8\u6027<\/strong>\uff1a<code>const<\/code> \u6cdb\u578b\u4f1a\u4f7f\u63a8\u65ad\u51fa\u7684\u5bf9\u8c61\u5c5e\u6027\u53d8\u4e3a <code>readonly<\/code>\uff0c\u82e5\u540e\u7eed\u9700\u8981\u4fee\u6539\uff0c\u8bf7\u663e\u5f0f\u58f0\u660e\u7c7b\u578b\u6216\u4f7f\u7528 <code>satisfies<\/code>\u3002<\/li>\n<li><strong>satisfies \u4e0e\u7c7b\u578b\u65ad\u8a00<\/strong>\uff1a<code>satisfies<\/code> \u4e0d\u4f1a\u6539\u53d8\u7c7b\u578b\uff0c\u53ea\u662f\u68c0\u67e5\u3002\u82e5\u9700\u8981\u66f4\u5bbd\u6cdb\u7684\u7c7b\u578b\uff0c\u4ecd\u5e94\u4f7f\u7528\u7c7b\u578b\u6ce8\u89e3\u3002<\/li>\n<li><strong>\u6027\u80fd\u8003\u8651<\/strong>\uff1a\u88c5\u9970\u5668\u5728\u8fd0\u884c\u65f6\u589e\u52a0\u5c11\u91cf\u5f00\u9500\uff0c\u4f46\u901a\u5e38\u53ef\u5ffd\u7565\u3002\u5bf9\u4e8e\u9ad8\u9891\u8c03\u7528\u7684\u65b9\u6cd5\uff0c\u8c28\u614e\u4f7f\u7528\u3002<\/li>\n<\/ol>\n<h2>\u603b\u7ed3<\/h2>\n<p>TypeScript 5.x \u7684\u88c5\u9970\u5668\u3001<code>const<\/code> \u6cdb\u578b\u548c <code>satisfies<\/code> \u64cd\u4f5c\u7b26\uff0c\u5206\u522b\u4ece\u5143\u7f16\u7a0b\u3001\u7c7b\u578b\u63a8\u65ad\u548c\u7c7b\u578b\u68c0\u67e5\u4e09\u4e2a\u7ef4\u5ea6\u63d0\u5347\u4e86\u5f00\u53d1\u4f53\u9a8c\u3002\u638c\u63e1\u5b83\u4eec\uff0c\u4f60\u53ef\u4ee5\u5199\u51fa\u66f4\u7b80\u6d01\u3001\u66f4\u5b89\u5168\u3001\u66f4\u6613\u7ef4\u62a4\u7684\u4ee3\u7801\u3002\u5efa\u8bae\u5728\u4e0b\u4e00\u4e2a\u65b0\u9879\u76ee\u4e2d\u5c1d\u8bd5\u8fd9\u4e9b\u7279\u6027\uff0c\u9010\u6b65\u66ff\u6362\u65e7\u6a21\u5f0f\u3002<\/p>\n<p><strong>\u5ef6\u4f38\u9605\u8bfb<\/strong>\uff1a<\/p>\n<ul>\n<li>TypeScript \u5b98\u65b9\u53d1\u5e03\u8bf4\u660e\uff1ahttps:\/\/devblogs.microsoft.com\/typescript\/announcing-typescript-5-0\/<\/li>\n<li>TC39 \u88c5\u9970\u5668\u63d0\u6848\uff1ahttps:\/\/github.com\/tc39\/proposal-decorators<\/li>\n<li>\u7c7b\u578b\u4f53\u64cd\u8fdb\u9636\uff1a\u6761\u4ef6\u7c7b\u578b\u4e0e\u6620\u5c04\u7c7b\u578b<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u6df1\u5165 TypeScript 5.x \u4e09\u5927\u8fdb\u9636\u7279\u6027\uff1a\u88c5\u9970\u5668\u5143\u7f16\u7a0b\u3001const \u6cdb\u578b\u4e0e satisfies \u64cd\u4f5c\u7b26\u3002\u901a\u8fc7\u5b8c\u6574\u53ef\u8fd0\u884c\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u63d0\u5347\u7c7b\u578b\u5b89\u5168\u4e0e\u5f00\u53d1\u6548\u7387\uff0c\u5e76\u5206\u4eab\u907f\u5751\u7ecf\u9a8c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[254,255,40,36,66,129],"class_list":["post-273","post","type-post","status-publish","format-standard","hentry","category-3","category-4","tag-const","tag-satisfies","tag-typescript","tag-36","tag-66","tag-129"],"_links":{"self":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=273"}],"version-history":[{"count":0,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/273\/revisions"}],"wp:attachment":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}