{
  "version": "https://jsonfeed.org/version/1", 
  "title": "TypeScript", 
  "description": "JavaScript that scales.", 
  "home_page_url": "https://www.v2ex.com/go/typescript", 
  "feed_url": "https://www.v2ex.com/feed/typescript.json", 
  "icon": "https://cdn.v2ex.com/navatar/20b5/e1cf/1047_large.png?m=1579032808", 
  "favicon": "https://cdn.v2ex.com/navatar/20b5/e1cf/1047_normal.png?m=1579032808", 
  "items": [
    {
      "author": {
        "url": "https://www.v2ex.com/member/blushyes", 
        "name": "blushyes", 
        "avatar": "https://cdn.v2ex.com/avatar/a117/7b39/726173_large.png?m=1758446142"
      }, 
      "url": "https://www.v2ex.com/t/1178835", 
      "date_modified": "2025-12-15T00:54:45+00:00", 
      "content_html": "<p>\u8981\u6c42\uff1a</p>\n<ul>\n<li>\u53ef\u4ee5\u8dd1\u5728 serverless \uff0c\u6700\u597d\u662f cf worker</li>\n<li>\u53ef\u4ee5\u914d\u7f6e\u5b58\u50a8(redis/d1/pg/...)</li>\n<li>\u5ba2\u6237\u7aef\u81ea\u5df1\u62c9\u914d\u7f6e\u5c31\u884c</li>\n<li>\u6700\u597d\u6709 webui</li>\n<li>ts \u751f\u6001</li>\n</ul>\n<p>\u8fd8\u662f\u8bf4\u6709\u4ec0\u4e48\u66f4\u597d\u7684\u89e3\u51b3\u65b9\u6848\u3002</p>\n<p>\u76ee\u524d\u6709\u4e2a\u75db\u70b9\u5c31\u662f\u5404\u79cd\u5730\u65b9\u9700\u8981\u4e71\u4e03\u516b\u7cdf\u7684\u914d\u7f6e\uff08\u5bf9\u5b9e\u65f6\u6027\u8981\u6c42\u4e0d\u9ad8\uff09\uff0c\u7f3a\u5c11\u4e00\u4e2a\u53ef\u4ee5\u65b9\u4fbf\u8bbf\u95ee\u914d\u7f6e\u3001\u4fee\u6539\u914d\u7f6e\u7684\u5730\u65b9\u3002</p>\n", 
      "date_published": "2025-12-14T12:29:01+00:00", 
      "title": "ts \u751f\u6001\u6709\u6ca1\u6709\u5f00\u6e90\u7684\u7b80\u5355\u7684 kv \u914d\u7f6e\u7ba1\u7406\u9879\u76ee", 
      "id": "https://www.v2ex.com/t/1178835"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Kinnikuman", 
        "name": "Kinnikuman", 
        "avatar": "https://cdn.v2ex.com/avatar/5951/a7f8/645335_large.png?m=1692927861"
      }, 
      "url": "https://www.v2ex.com/t/1177452", 
      "date_modified": "2025-12-09T00:36:08+00:00", 
      "content_html": "<p>\u4e00\u76f4\u5199 javascript \uff0c\u80fd\u770b\u61c2 ts \uff0c\u4f46\u81ea\u5df1\u4e0d\u4f1a\u5199\u3002\u867d\u7136\u73b0\u5728\u5927\u90e8\u5206\u4ee3\u7801\u90fd\u662f AI \u6765\u5199\uff0c\u4f46\u662f\u81ea\u5df1\u5982\u679c\u4e0d\u4f1a\u7684\u8bdd\uff0c\u603b\u611f\u89c9\u5b83\u5199\u7684\u4e0d\u89c4\u8303\u3002\u5c24\u5176\u662f AI \u94bb\u725b\u89d2\u5c16\u51fa\u4e0d\u6765\u65f6\u5019\uff0c\u53ef\u80fd\u6709\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005\u4e00\u770b\u5c31\u8ba9\u5b83\u6362\u4e2a\u65b9\u5f0f\u5c31\u80fd\u89e3\u51b3\u3002\u4f46\u662f\u4f60\u5982\u679c\u4e0d\u638c\u63e1\u8fd9\u9879\u6280\u672f\uff0c\u5c31\u6bd4\u8f83\u803d\u8bef\u65f6\u95f4\u3002</p>\n<p>\u6211\u4e3b\u8981\u662f\u60f3\u5b66\u4e60\u4e0b\u600e\u4e48\u624d\u80fd\u89c4\u8303\u7684\u5199\u597d ts \uff0c\u6709\u6ca1\u6709\u4f18\u79c0\u7684\u5c0f\u9879\u76ee\u6765\u505a\u53c2\u8003\uff1f</p>\n", 
      "date_published": "2025-12-08T01:08:59+00:00", 
      "title": "\u4f60\u4eec\u662f\u600e\u4e48\u5b66\u4e60 typescript \u7684\uff1f", 
      "id": "https://www.v2ex.com/t/1177452"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/CosmoLau", 
        "name": "CosmoLau", 
        "avatar": "https://cdn.v2ex.com/gravatar/dfee236886644a522fa09ca737e70be1?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1176909", 
      "title": "\u7528 Go \u79fb\u690d\u7684 TypeScript 7 \u8981\u6765\u4e86", 
      "id": "https://www.v2ex.com/t/1176909", 
      "date_published": "2025-12-04T07:17:01+00:00", 
      "content_html": "<p>\u539f\u6587\u535a\u5ba2\uff1a <a href=\"https://devblogs.microsoft.com/typescript/progress-on-typescript-7-december-2025/\" rel=\"nofollow\">https://devblogs.microsoft.com/typescript/progress-on-typescript-7-december-2025/</a></p>\n<p>\u7701\u6d41\uff1a</p>\n<blockquote>\n<h1>TypeScript 6.0 is the Last JavaScript-Based Release</h1>\n<h1>TypeScript 6.0 \u662f\u57fa\u4e8e JavaScript \u7684\u6700\u540e\u4e00\u4e2a\u7248\u672c</h1>\n<p>TypeScript 6.0 will be our last release based on the existing TypeScript/JavaScript codebase. In other words, we do not intend to release a TypeScript 6.1, though we may have patch releases (e.g. 6.0.1, 6.0.2) under rarer circumstances.\nTypeScript 6.0 \u5c06\u662f\u6211\u4eec\u57fa\u4e8e\u73b0\u6709 TypeScript/JavaScript \u4ee3\u7801\u5e93\u7684\u6700\u540e\u4e00\u4e2a\u7248\u672c\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u6211\u4eec\u65e0\u610f\u53d1\u5e03 TypeScript 6.1 \uff0c\u5c3d\u7ba1\u5728\u6781\u5c11\u6570\u60c5\u51b5\u4e0b\u53ef\u80fd\u4f1a\u53d1\u5e03\u8865\u4e01\u7248\u672c\uff08\u4f8b\u5982 6.0.1 \u30016.0.2 \uff09\u3002</p>\n</blockquote>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Ketteiron", 
        "name": "Ketteiron", 
        "avatar": "https://cdn.v2ex.com/avatar/3ea5/0983/526953_large.png?m=1769416140"
      }, 
      "url": "https://www.v2ex.com/t/1159469", 
      "title": "TypeScript5.9\uff0c\u4eff\u4f5b\u8d70\u51fa\u8349\u539f\u6765\u5230\u4e86\u73b0\u4ee3\u793e\u4f1a", 
      "id": "https://www.v2ex.com/t/1159469", 
      "date_published": "2025-09-15T17:18:01+00:00", 
      "content_html": "<p>TypeScript5.9 \u521a\u51fa\u5c31\u5173\u6ce8\u4e86\uff0c\u4ee4\u6211\u60ca\u559c\u7684\u662f\u8fd9\u4e09\u4e2a\u53d8\u5316\uff1a<code>\u53ef\u6269\u5c55\u60ac\u505c</code>+<code>\u60ac\u505c\u6700\u5927\u957f\u5ea6\u914d\u7f6e</code>+<code>\u7f13\u5b58\u5b9e\u4f8b</code></p>\n<p>\u4e0d\u8fc7\u5f53\u65f6\u5728 vscode \u4e0a\u6478\u4e86\u534a\u5929\u6ca1\u6cd5\u5f00\u542f\uff0c\u800c\u4e14 eslint \u5f53\u65f6\u6682\u65f6\u8fd8\u4e0d\u652f\u6301 5.9 \uff0c\u4e8e\u662f\u5c31\u56de\u9000 5.8 \u3002</p>\n<p>\u4eca\u5929\u6709\u65f6\u95f4\u5c1d\u8bd5\u4e86\u4e00\u4e0b\uff0cvscode \u7248\u672c\u5927\u4e8e 1.103 \u4e14 TypeScript \u7248\u672c\u5927\u4e8e 5.9 \uff0c\u9ed8\u8ba4\u5f00\u542f\u53ef\u6269\u5c55\u60ac\u505c\uff0c\u4e4b\u524d\u7528\u8fc7\u5b9e\u9a8c\u6027\u914d\u7f6e\u7684\u53ef\u4ee5\u5220\u6389\u8fd9\u4e2a\u65e0\u7528\u914d\u7f6e\u4e86 \"typescript.experimental.expandableHover\": true</p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\u90e8\u5206\u63d2\u4ef6\u4f1a\u963b\u6b62\u8fd9\u4e2a\u529f\u80fd\uff0cvue/svelte/astro \u7b49\u63d2\u4ef6\u8981\u4e48\u5347\u5230\u6700\u65b0\u7248\u8981\u4e48\u7981\u7528</p>\n<p>\u5047\u8bbe\u6709\u8fd9\u4e48\u4e00\u4e2a\u51fd\u6570\uff0c\u6307\u5b9a\u4e86\u4e09\u4e2a\u53c2\u6570</p>\n<pre><code class=\"language-typescript\">function test1(option: { a: string; b: number; c: boolean }) {\n  console.log(option)\n}\n</code></pre>\n<p>\u60ac\u6d6e\u5728\u51fd\u6570\u540d\u4e0a\uff0c\u5f97\u5230\u7684\u662f</p>\n<pre><code class=\"language-typescript\">function test1(option: {\n    a: string;\n    b: number;\n    c: boolean;\n}): void\n</code></pre>\n<p>\u5982\u679c\u8fd9\u4e2a\u53c2\u6570\u7c7b\u578b\u9700\u8981\u5728\u5176\u4ed6\u5730\u65b9\u4f7f\u7528\uff0c\u53ea\u80fd\u628a\u5185\u8054\u7c7b\u578b\u8f6c\u6210\u63a5\u53e3\u6216\u8005\u7c7b\u578b\u522b\u540d</p>\n<pre><code class=\"language-typescript\">type Option = { a: string; b: number; c: boolean }\n\nfunction test2(option: Option) {\n  console.log(option)\n}\n</code></pre>\n<p>\u6b64\u65f6\u9884\u89c8\u7ed3\u679c\u53d8\u6210\u4e86\u8fd9\u6837</p>\n<pre><code class=\"language-typescript\">function test2(option: Option): void\n</code></pre>\n<p>\u60f3\u8981\u770b\u7c7b\u578b\uff1f</p>\n<ol>\n<li>\u8bf7\u6eda\u5230\u5b9a\u4e49\u7684\u5730\u65b9\u81ea\u5df1\u53bb\u770b\u3002</li>\n<li>Alt + F12 \u901f\u89c8\u5b9a\u4e49</li>\n</ol>\n<p>\u90fd\u975e\u5e38\u4e0d\u65b9\u4fbf\uff0c\u800c\u4e14\u7c7b\u578b\u5982\u679c\u7ecf\u8fc7\u591a\u6b21\u5c01\u88c5\uff0c\u4eba\u5de5\u53bb\u5c55\u5f00\u7c7b\u578b\u7b80\u76f4\u662f\u5730\u72f1\u822c\u7684\u4f53\u9a8c\u3002</p>\n<p>\u800c 5.9 \u7684\u53ef\u6269\u5c55\u60ac\u505c\u5c31\u662f\u8fd8\u539f\u4e86\u5185\u8054\u7c7b\u578b\u9884\u89c8\uff0c\u4e0d\u9700\u8981\u8dd1\u5230\u7c7b\u578b\u5b9a\u4e49\u67e5\u770b\u91cc\u9762\u5230\u5e95\u6709\u5565\u7c7b\u578b\uff0c\u539f\u5730\u5c31\u80fd\u5c55\u5f00\u3002\u867d\u7136\u6709\u4e9b\u7c7b\u578b\u6211\u8bd5\u4e86\u4e0b\u5e76\u4e0d\u80fd\u5c55\u5f00\uff0c\u4f46\u76f8\u6bd4\u539f\u6765\u7684\u56db\u5904\u6a2a\u8df3\u4f53\u9a8c\u597d\u4e86\u51e0\u767e\u500d\u3002</p>\n<p>\u53e6\u5916\u4e5f\u589e\u52a0\u4e86\u60ac\u505c\u957f\u5ea6\u914d\u7f6e\u9879\uff0c\u539f\u672c\u51fa\u4e8e\u6027\u80fd\u8003\u8651\uff0ctypescript \u7ed9\u7684\u9ed8\u8ba4\u503c\u662f 160 \uff0c\u8fd9\u5bfc\u81f4\u4e86\u7c7b\u578b\u53ea\u8981\u7a0d\u5927\u4e00\u70b9\u60ac\u6d6e\u6846\u5c31\u4f1a\u622a\u65ad\u6216\u8005\u7701\u7565\u5185\u5bb9\uff0c\u5e76\u4e14\u65e0\u6cd5\u8c03\u6574\uff0c5.9 \u5c06\u8fd9\u4e2a\u503c\u8bbe\u7f6e\u6210 500 \uff0c\u4f46\u6211\u5efa\u8bae\u5728 vscode \u4e2d\u914d\u7f6e\u66f4\u5927\u7684\u503c\u4ee5\u4fbf\u5b8c\u5168\u5c55\u5f00\u5927\u578b\u590d\u6742\u7c7b\u578b\u3002</p>\n<p>\"js/ts.hover.maximumLength\": 1000 // \u4e2a\u4eba\u5efa\u8bae\u81f3\u5c11 1000 \uff0c\u6211\u81ea\u5df1\u8bbe\u7f6e\u4e86 5000</p>\n<p>\u5bf9\u5173\u6ce8\u7c7b\u578b\u5b89\u5168\u7684 TypeScript \u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0czod \u7b49\u7c7b\u578b\u6821\u9a8c\u6846\u67b6\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u5b83\u89e3\u51b3\u4e86\u7edf\u4e00\u8fd0\u884c\u65f6\u4e0e\u7f16\u8bd1\u65f6\u7c7b\u578b\u7684\u96be\u9898\uff0c\u5c06\u8fd0\u884c\u65f6\u68c0\u67e5\u4e0e\u9759\u6001\u7c7b\u578b\u7edf\u4e00\u4e3a\u5355\u4e00\u53ef\u4fe1\u6e90\uff0c\u53ef\u4ee5\u901a\u8fc7\u6821\u9a8c\u884c\u4e3a\u751f\u6210\u5b89\u5168\u7684\u5165\u53c2\u7c7b\u578b\uff0c\u518d\u914d\u5408 tRPC \u7b49\u8fdc\u7a0b\u8c03\u7528\uff0c\u7f16\u5199\u63a5\u53e3\u5b9e\u73b0\u7684\u672c\u8eab\u5c31\u662f\u5728\u4e25\u683c\u5b9a\u4e49\u5176\u5165\u53c2\u4e0e\u8fd4\u56de\u7c7b\u578b\uff0c\u524d\u7aef\u53ea\u9700\u8c03\u7528\u63a5\u53e3\u5e76\u901a\u8fc7\u6cdb\u578b\u590d\u7528\u5165\u53c2\u4e0e\u8fd4\u56de\u503c\u7c7b\u578b\uff0c\u4e0d\u9700\u8981\u989d\u5916\u5b9a\u4e49\u7c7b\u578b\u5374\u80fd\u6574\u4e2a\u94fe\u8def\u90fd\u53d7\u5230\u7c7b\u578b\u7684\u5236\u7ea6\uff0c\u5b9e\u73b0\u4e86\u771f\u6b63\u6709\u5b9e\u9645\u610f\u4e49\u7684\u7c7b\u578b\u5b89\u5168\uff0c\u5b9e\u73b0\u4e86\u7c7b\u578b\u5373\u6587\u6863\u3002\u4f46\u8fd9\u7c7b\u6846\u67b6\u5e26\u7ed9 typescript \u7684\u6027\u80fd\u8d1f\u62c5\u662f\u6bc1\u706d\u6027\u7684\uff0c\u8fd9\u662f\u5f53\u524d TypeScript \u9879\u76ee\u9762\u4e34\u7684\u6700\u5927\u6311\u6218\uff0czod+tRPC \u7b49\u6846\u67b6\u4e0d\u4ec5\u5e26\u6765\u4e86\u7c7b\u578b\u5b89\u5168\uff0c\u8fd8\u5e26\u6765\u4e86\u6307\u6570\u589e\u957f\u7684\u7c7b\u578b\u5b9e\u4f8b\u5316\u5f00\u9500\u3002</p>\n<p>\u4ee5\u6211\u5f53\u524d\u7ef4\u62a4\u7684 honojs \u5168\u6808\u9879\u76ee\u4e3e\u4f8b\uff0c\u4f7f\u7528 zod+hono \u81ea\u5e26\u7684 RPC \uff0c\u63a5\u53e3\u6570\u91cf\u5728 100 \u4e2a\u5de6\u53f3\uff0c\u540e\u7aef\u4ee3\u7801\u968f\u4fbf\u4e00\u6539 tsserver \u5c31\u5f97\u6682\u505c 10 \u79d2\uff0c\u8fd9\u610f\u5473\u7740 10 \u79d2\u5185\u6211\u5931\u53bb\u4e86\u4ee3\u7801\u8865\u5168\u3001\u7b7e\u540d\u5e2e\u52a9\u3001\u9519\u8bef\u68c0\u67e5\u3001\u60ac\u505c\u63d0\u793a\u3001\u667a\u80fd\u8865\u5168\u7b49\u7b49 typescript \u5e26\u6765\u7684\u76ca\u5904\uff0c\u9000\u5316\u6210 js \u539f\u59cb\u4eba\uff0c\u7f16\u5199\u5927\u578b ts \u9879\u76ee\u7684\u4eba\u5e94\u8be5\u4f1a\u6df1\u6709\u4f53\u4f1a\u3002</p>\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u6162\uff1f\u56e0\u4e3a RPC \u662f\u5bfc\u51fa\u6574\u4e2a\u8def\u7531\u7c7b\u578b\uff0c\u6bcf\u4e2a\u63a5\u53e3\u90fd\u6709\u7531 zod \u751f\u6210\u7684\u5b9e\u4f8b\u53c2\u6570\u7c7b\u578b\u4e0e return \u7684\u8fd4\u56de\u7c7b\u578b\uff0c\u6240\u6709\u63a5\u53e3\u5168\u90e8\u94fe\u63a5\u5728\u4e00\u8d77\uff0c\u7ec4\u6210\u4e00\u4e2a\u5de8\u5927\u65e0\u6bd4\u7684\u7c7b\u578b\u4ea4\u7ed9\u524d\u7aef\u9879\u76ee\u4f7f\u7528\u3002</p>\n<p>\u53ef\u60dc z.infer \u5b9e\u5728\u592a\u6162\u4e86\uff0c\u6bcf\u4e00\u6b21\u7b80\u5355\u7684\u4ee3\u7801\u6539\u52a8\uff0c\u65e0\u6570\u4e2a zod \u7c7b\u578b\u90fd\u8981\u5168\u90e8\u91cd\u65b0\u63a8\u65ad\u4e00\u904d\uff0c\u5bfc\u81f4 RPC+zod \u9879\u76ee\u5230\u4e86\u4e00\u5b9a\u89c4\u6a21\u6bcf\u4e2a\u5f00\u53d1\u4eba\u5458\u4f1a\u88ab\u8feb\u81ea\u52a8\u5b66\u4f1a\u65f6\u95f4\u6682\u505c\u3002</p>\n<p>\u5230\u4e86\u8fd9\u65f6\u5019\uff0c\u5c31\u9700\u8981\u8003\u8651\u4e0d\u518d\u7531 tsserver \u53bb\u5b9e\u65f6\u63a8\u65ad\u7c7b\u578b\uff0c\u800c\u662f\u5148\u7f16\u8bd1\u540e\u7aef\u9879\u76ee\uff0c\u524d\u7aef\u4ec5\u4f7f\u7528\u9759\u6001\u7c7b\u578b\uff0c\u4f46\u7f16\u8bd1\u5f88\u96be\u505a\u5230\u65e0\u75db\u65e0\u611f\uff0c\u603b\u5f52\u4f1a\u5bf9\u5f00\u53d1\u6709\u5f71\u54cd\u3002</p>\n<p>typescript5.9 \u7684 Cache Instantiations on Mappers \u5f88\u5927\u7a0b\u5ea6\u7f13\u89e3\u4e86\u8fd9\u4e2a\u96be\u9898\uff0c\u4ee5\u6211\u5f53\u524d\u9879\u76ee\u6765\u8bf4\uff0cthe world \u4ece\u5341\u79d2\u53d8\u6210\u4e24\u79d2\uff0c\u5b8c\u5168\u80fd\u63a5\u53d7\uff0c\u5207\u6362\u6210 ts-go \u66f4\u5feb\uff0c\u53ef\u60dc\u4e0d\u7a33\u5b9a\u3002</p>\n<p>TypeScript \u5f88\u597d\uff0c\u800c\u4e14\u5728\u8d8a\u53d8\u8d8a\u597d\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Flands", 
        "name": "Flands", 
        "avatar": "https://cdn.v2ex.com/avatar/34be/5ea4/96261_large.png?m=1635252842"
      }, 
      "url": "https://www.v2ex.com/t/1145369", 
      "date_modified": "2025-07-15T11:43:14+00:00", 
      "content_html": "<p>\u6700\u8fd1\u5199\u7a0d\u5fae\u590d\u6742\u70b9\u7684\u7ec4\u4ef6\uff0c\u53d1\u73b0 TS \u7684\u77e5\u8bc6\u50a8\u5907\u4e0d\u591f\u7528\uff0c\u5f88\u591a\u590d\u6742\u7684\u7c7b\u578b\u4e0d\u597d\u5b9a\u4e49\uff0c\u82b1\u8d39\u4e86\u592a\u591a\u65f6\u95f4\u5728 ts \u4e0a\u3002\n\u6bd4\u5982</p>\n<pre><code>export type Field =\n  | IFieldText\n  | IFieldSingleSelect\n\ntype IFieldText = {\n  type: 'text'\n}\n\ntype IFieldSingleSelect = {\n  type: 'single_select'\n\n  // \u9009\u9879\n  options: ISelectOption[]\n}\n\n</code></pre>\n<p>\u6b64\u65f6\u6211\u60f3\u5b9a\u4e49\u4e00\u4e2a\u8868\u5355\uff0c\u8868\u5355\u7684 key \u4e3a Field \u8054\u5408\u7c7b\u578b\u4e2d\u53ef\u80fd\u5b58\u5728\u7684 key \uff0c\u6b64\u65f6\u4f1a\u62a5 options \u4e0d\u5b58\u5728</p>\n<pre><code>type form:Field = { type: \"\", options: \"\" }\n</code></pre>\n<p>\u8fd8\u6709\u8868\u5355\u7684\u6570\u636e\u7c7b\u578b\u6839\u636e field.type \u8fdb\u884c\u53d8\u5316\u7b49\u7b49\n\u8fd9\u79cd\u7a0d\u5fae\u590d\u6742\u70b9\u7684\u5c31\u6293\u8033\u6320\u816e\uff0caugment \u5199\u7684\u4e5f\u4e0d\u597d</p>\n<p>\u6709\u6ca1\u6709\u66f4\u65b9\u4fbf\u89e3\u51b3\u8fd9\u79cd\u95ee\u9898\u7684\u529e\u6cd5</p>\n", 
      "date_published": "2025-07-15T08:54:48+00:00", 
      "title": "Typescript \u6709\u6ca1\u6709\u80fd\u5bf9\u63a5 AI \u7684\u77e5\u8bc6\u5e93\u6216\u8005\u6587\u6863\uff1f\u80fd\u5904\u7406\u7a0d\u5fae\u590d\u6742\u70b9\u7684\u7c7b\u578b", 
      "id": "https://www.v2ex.com/t/1145369"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/tmkook", 
        "name": "tmkook", 
        "avatar": "https://cdn.v2ex.com/avatar/528a/ecdf/3238_large.png?m=1753384979"
      }, 
      "url": "https://www.v2ex.com/t/1139989", 
      "date_modified": "2025-06-21T00:45:24+00:00", 
      "content_html": "<pre><code class=\"language-typescript\">class a extends schema {\n    fun1 () =&gt; 1\n}\nclass b extends schema{\n    fun2 () =&gt; 2\n}\n\nconst objs = {\n    a:new a\n    b:new b\n}\n\nfunction find(key) : any{\n    return objs[key]\n}\n</code></pre>\n<p>\u8fd9\u4e2a objs \u5f88\u591a\u4e2a obj \u4ed6\u4eec\u90fd\u7ee7\u627f\u81ea\u540c\u4e00\u4e2a\u7236\u7c7b\uff0c\u6709\u4ec0\u4e48\u529e\u6cd5\u5728\u8c03\u7528 find \u8fd4\u56de\u7684\u5bf9\u8c61\u80fd\u4fdd\u6301\u4ee3\u7801\u63d0\u793a\u5417\uff1f</p>\n<pre><code>let obj = find('a')\nobj.fun1 //\u4ee3\u7801\u63d0\u793a\n\n</code></pre>\n", 
      "date_published": "2025-06-20T10:00:50+00:00", 
      "title": "typescript \u5982\u4f55\u8fd4\u56de\u4e00\u4e2a\u52a8\u6001\u5bf9\u8c61\u7c7b\u578b", 
      "id": "https://www.v2ex.com/t/1139989"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Asuler", 
        "name": "Asuler", 
        "avatar": "https://cdn.v2ex.com/avatar/ec35/911a/420115_large.png?m=1749794334"
      }, 
      "url": "https://www.v2ex.com/t/1138388", 
      "title": "ts \u6709\u6ca1\u6709\u76f4\u63a5\u80fd\u67e5\u770b\u6700\u7ec8\u7c7b\u578b\u7684\u65b9\u6cd5", 
      "id": "https://www.v2ex.com/t/1138388", 
      "date_published": "2025-06-13T06:02:57+00:00", 
      "content_html": "\u5728 vscode \u4e2d\uff0cimport \u67d0\u4e2a\u5305\u91cc\u7684\u67d0\u4e2a\u7c7b\u578b\u540e\uff0c\u6211\u60f3\u770b\u770b\u8fd9\u4e2a\u7c7b\u578b\u6700\u7ec8\u662f\u4ec0\u4e48\u6837\u7684\uff0c\u7ed3\u679c\u70b9\u8fdb\u53bb\u4e00\u5c42\u5957\u4e00\u5c42\uff0c\u5404\u79cd ts \u64cd\u4f5c\u7b26\u6ee1\u5929\u98de<br /><br />\u5176\u5b9e\u6211\u5c31\u60f3\u77e5\u9053\u8fd9\u4e2a\u7c7b\u578b\u7684\u67d0\u4e2a\u51fd\u6570\u7684\u53c2\u6570\u7c7b\u578b\u662f\u5565\uff0c\u4f46\u662f\u8981\u4e00\u5c42\u4e00\u5c42\u70b9\u8fdb\u53bb\uff0c\u800c\u4e14\u70b9\u8fdb\u53bb\u540e\u8fd8\u5206\u597d\u51e0\u5c42\uff0c\u5b8c\u5168\u4e0d\u77e5\u9053\u6211\u60f3\u8981\u7684\u51fd\u6570\u662f\u5728\u54ea\u4e00\u5c42<br /><br />\u6709\u6ca1\u6709\u529e\u6cd5\u80fd\u76f4\u63a5\u770b\u5230\uff0c\u5305\u62ec\u4f46\u4e0d\u5c40\u9650\u4e8e vscode \u63d2\u4ef6\uff0cnpm \u5305\u7b49"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Fdyo", 
        "name": "Fdyo", 
        "avatar": "https://cdn.v2ex.com/avatar/fdea/9749/134864_large.png?m=1769104321"
      }, 
      "url": "https://www.v2ex.com/t/1133680", 
      "title": "TypeScript Native \u9884\u89c8\u7248\u53d1\u5e03\u4e86", 
      "id": "https://www.v2ex.com/t/1133680", 
      "date_published": "2025-05-22T23:55:42+00:00", 
      "content_html": "<p>\u4eca\u5929\uff0c\u5fae\u8f6f\u6b63\u5f0f\u5ba3\u5e03 TypeScript Native \u9884\u89c8\u7248\uff08 TypeScript Native Preview \uff09\u9762\u5411\u5f00\u53d1\u8005\u5e7f\u6cdb\u5f00\u653e\u3002 \u6839\u636e\u5b98\u65b9\u535a\u5ba2\u4ecb\u7ecd\uff0c\u65b0\u7248\u672c\u5728\u591a\u6570\u771f\u5b9e\u4e16\u754c\u9879\u76ee\u4e2d\u5e26\u6765\u4e86 10 \u500d\u4ee5\u4e0a\u7684\u7f16\u8bd1\u6027\u80fd\u63d0\u5347\u3002</p>\n<p>\u539f\u6587\uff1a<a href=\"https://windiscover.com/posts/typescript-native-is-now-available.html\" rel=\"nofollow\">TypeScript Native \u9884\u89c8\u7248\u6b63\u5f0f\u53d1\u5e03\uff0c\u5e26\u6765 10 \u500d\u4ee5\u4e0a\u7f16\u8bd1\u6027\u80fd\u63d0\u5347</a></p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/DreamingCTW", 
        "name": "DreamingCTW", 
        "avatar": "https://cdn.v2ex.com/avatar/add3/59ad/488109_large.png?m=1775617710"
      }, 
      "url": "https://www.v2ex.com/t/1123060", 
      "date_modified": "2025-04-03T04:27:38+00:00", 
      "content_html": "<h4>\u6211\u662f\u505a Java \u540e\u7aef\u7684\uff0c\u8fd9\u4e24\u5929\u6b63\u5728\u7cfb\u7edf\u5316\u7684\u5b66\u4e60 ts \uff0c\u5b66\u5230\u88c5\u9970\u5668\u7684\u65f6\u5019\uff0c\u6709\u70b9\u7591\u60d1\uff0c\u5e0c\u671b\u53ef\u4ee5\u6307\u5bfc\u4e0b\uff0c\u8c22\u8c22\u5927\u5bb6\u3002\u4ee5\u4e0b\u662f Demo</h4>\n<pre><code class=\"language-TypeScript\">type Constructor = new (...args: any[]) =&gt; {};\n\nfunction LogTime&lt;T extends Constructor&gt;(target: T) {\n  return class extends target {\n    createTime: Date;\n    constructor(...args: any[]) {\n      super(...args);\n      this.createTime = new Date();\n    }\n    getCreateTime() {\n      return `\u8be5\u5bf9\u8c61\u7684\u521b\u5efa\u65f6\u95f4\u662f\uff1a${this.createTime}`;\n    }\n  };\n}\n\n@LogTime\nclass Person {\n  name: string;\n  age: number;\n  constructor(name: string, age: number) {\n    this.name = name;\n    this.age = age;\n  }\n}\n\ninterface Person {\n  getCreateTime(): void;\n}\n\nconst person = new Person(\"\u5c0f\u660e\", 18);\nconsole.log(person.getCreateTime());\n</code></pre>\n<h4>\u5982\u679c\u4e0d\u58f0\u660e interface Person { getCreateTime(): void }\uff0c\u90a3\u4e48 person.getCreateTime()\u4f1a\u62a5\u9519\uff0c\u63d0\u793a Person \u5bf9\u8c61\u4e2d\u6ca1\u6709\u8fd9\u4e2a\u5c5e\u6027\u3002\u52a0\u4e0a\u8fd9\u4e2a\u63a5\u53e3\u5c31\u4e0d\u4f1a\u62a5\u9519\u4e86\uff0c\u4f46\u6709\u4e00\u4e2a\u95ee\u9898\uff0c\u63a5\u53e3\u4e2d\u89c4\u8303\u4e86 getCreateTime()\u51fd\u6570\u7684\u8fd4\u56de\u503c\u4e3a void \uff0c\u5b9e\u9645\u4e0a\u88c5\u9970\u5668\u4e2d getCreateTime()\u8fd4\u56de\u7684\u662f string \uff0c\u8fd9\u4e0d\u77db\u76fe\u5417\uff1f\u6211\u5c1d\u8bd5\u4fee\u6539\u63a5\u53e3\u4e2d\u7684 getCreateTime()\u51fd\u6570\u7684\u8fd4\u56de\u503c\uff0c\u53d1\u73b0\u6539\u6210\u4efb\u610f\u7c7b\u578b\u90fd\u53ef\u4ee5...</h4>\n<h4>\u73b0\u5728\u7ed9\u6211\u7684\u611f\u89c9\u5c31\u662f\uff0c\u4e3a\u4e86\u8ba9 person.getCreateTime()\u4ee3\u7801\u4e0d\u62a5\u9519\uff0c\u5c31\u6253\u4e86 interface Person \u8fd9\u4e2a\u8865\u4e01\uff0c\u800c\u4e14\u53ef\u4ee5\u4e0d\u5f3a\u5236\u9075\u5faa\u8fd9\u4e2a\u8865\u4e01\u7684\u89c4\u8303\u3002</h4>\n<h4>\u7531\u6b64\u6211\u60f3\u5230\u4e86\u53e6\u4e00\u4e2a\u95ee\u9898\uff0c\u4ece\u4e0a\u8ff0\u4ee3\u7801\u770b\uff0cPerson \u65e2\u662f\u4e00\u4e2a class \uff0c\u4e5f\u662f\u4e00\u4e2a interface \uff0c\u6211\u8fd8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 class \u6765 implements Person \uff0c\u53d1\u73b0 class Person \u4e2d\u7684\u6240\u6709\u5c5e\u6027\u4e5f\u90fd\u8981\u5b9e\u73b0\uff0c\u6240\u4ee5 interface Person \u662f\u628a class Person \u8f6c\u6210\u4e86\u63a5\u53e3\uff1f</h4>\n<pre><code class=\"language-TypeScript\">class NewPerson implements Person {\n  name: string;\n  age: number;\n  createTime: Date;\n  constructor(name: string, age: number) {\n    this.name = name;\n    this.age = age;\n    this.createTime = new Date();\n  }\n  getCreateTime() {\n    return `\u8be5\u5bf9\u8c61\u7684\u521b\u5efa\u65f6\u95f4\u662f\uff1a${this.createTime}`;\n  }\n}\n</code></pre>\n", 
      "date_published": "2025-04-03T03:06:14+00:00", 
      "title": "\u5173\u4e8e TypeScript \u88c5\u9970\u5668\u548c\u63a5\u53e3\u7684\u95ee\u9898\uff0c\u8bf7\u6559\u4e00\u4e0b\u5404\u4f4d", 
      "id": "https://www.v2ex.com/t/1123060"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/june4", 
        "name": "june4", 
        "avatar": "https://cdn.v2ex.com/avatar/4555/12c1/661756_large.png?m=1767580261"
      }, 
      "url": "https://www.v2ex.com/t/1121907", 
      "title": "\u4f60\u4eec typescript \u7528\u81ea\u5e26\u679a\u4e3e\u8fd8\u662f\u5b57\u7b26\u4e32\u679a\u4e3e\uff0c\u611f\u89c9\u5b57\u7b26\u4e32\u679a\u4e3e\u7c7b\u578b\u7528\u8d77\u6765\u6709\u70b9\u4e0d\u53ef\u9760\u554a", 
      "id": "https://www.v2ex.com/t/1121907", 
      "date_published": "2025-03-29T02:51:05+00:00", 
      "content_html": "<p>\u6bd4\u5982:</p>\n<pre><code>type InputType = 'text' | 'number'\nlet e: InputType | undefined = 'text'\nconst getHtmlStr = (t: InputType | undefined) =&gt; `${t === 'text' ? 'type=text' : '...'}`\n</code></pre>\n<p>\u6211\u7ed9\u679a\u4e3e\u6765\u4e2a\u91cd\u547d\u540d\u5427\uff0c\u628a 'text' \u6539\u6210 'text2'\uff0c\u4e0b\u9762\u7528\u5230\u7684\u5730\u65b9\u5168\u90fd\u6ca1\u6709\u6539\u8fc7\u6765\uff0c\u8981\u624b\u52a8\u6539\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/llej", 
        "name": "llej", 
        "avatar": "https://cdn.v2ex.com/avatar/b4e7/fabc/451595_large.png?m=1596437487"
      }, 
      "url": "https://www.v2ex.com/t/1121110", 
      "title": "effect-ts", 
      "id": "https://www.v2ex.com/t/1121110", 
      "date_published": "2025-03-26T02:18:33+00:00", 
      "content_html": "<h1>effect-ts</h1>\n<p><a href=\"https://effect.website/\" rel=\"nofollow\">https://effect.website/</a></p>\n<h2>\u4e3a\u4ec0\u4e48\u662f effect-ts</h2>\n<p>\u6700\u8fd1\u63a5\u89e6\u5230\u4e86 Effect ts (<a href=\"https://www.zhihu.com/question/623903161/answer/126528926028\" rel=\"nofollow\">\u5982\u4f55\u770b\u5f85 fp-ts \u53ca effect-ts \u5206\u522b\u5b9e\u65bd\u7684\u4e24\u79cd\u98ce\u683c\u76f8\u5f02\u7684\u9ad8\u9636\u7c7b\u578b\u7cfb\u7edf\uff1f</a>) \uff0c\u987f\u65f6\u611f\u89c9\u8fd9\u5c31\u662f\u6211\u4e00\u76f4\u8ffd\u6c42\u7684\u4e1c\u897f\uff0c\u4ee5\u524d\u5199\u8fc7 <a href=\"https://shenzilong.cn/index/%E5%AF%B9%E4%BA%8E%E4%BE%9D%E8%B5%96%E6%B3%A8%E5%85%A5%E7%9A%84%E6%80%9D%E8%80%83-%E4%BA%8C.html#20250202145716-wvgw7m7\" rel=\"nofollow\">\u5bf9\u4e8e\u4f9d\u8d56\u6ce8\u5165\u7684\u601d\u8003-\u4e8c</a> \u7b49\u6587\u7ae0\uff0cEffect \u5b8c\u7f8e\u7684\u6ee1\u8db3\u4e86\u6211\u7684\u9700\u6c42\u3002</p>\n<p>ts \u5e26\u6765\u4e86\u65e0\u4e0e\u4f26\u6bd4\u7684\u7c7b\u578b\u64cd\u4f5c\uff0c\u4f46\u4e2a\u4eba\u60f3\u8981\u5199\u51fa\u4e00\u4e2a\u4e25\u8c28\u7684 ts \u7a0b\u5e8f\uff0c\u5c24\u5176\u662f\u80fd\u591f\u786e\u4fdd\u6b63\u786e\u7684\u9519\u8bef\u5904\u7406\u548c\u4f9d\u8d56\u5904\u7406\u4f9d\u65e7\u662f\u4e00\u4e2a\u5f88\u96be\u7684\u4e8b\u60c5\uff0c\u5c24\u5176\u662f\u4f9d\u8d56\u5012\u7f6e\u3002</p>\n<p><strong>\u9519\u8bef\u5904\u7406</strong>\uff1ats \u7684 catch \u8bed\u53e5\u4e2d\u7684 error \u9ed8\u8ba4\u7c7b\u578b\u662f <code>unknown</code> \u3002\u8fd9\u662f\u975e\u5e38\u7a33\u5065\u7684\uff0c\u56e0\u4e3a\u4e8b\u5b9e\u4e0a\u5c31\u662f\u6ca1\u6cd5\u77e5\u9053\u4e00\u6bb5\u7a0b\u5e8f\u4f1a\u629b\u51fa\u54ea\u4e9b\u9519\u8bef\uff0c\u800c effect-ts \u5c06\u9519\u8bef\u5728\u8fd4\u56de\u503c\u7c7b\u578b\u4e2d\u8fdb\u884c\u8fdb\u884c\u4e86\u663e\u5f0f\u6807\u6ce8\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u77e5\u9053\u4e00\u6bb5\u7a0b\u5e8f\u53ef\u80fd\u4f1a\u629b\u51fa\u54ea\u4e9b\u9519\u8bef\u4e86\u3002</p>\n<p><strong>\u4f9d\u8d56\u5904\u7406</strong>\uff1a\u8fd9\u4e2a\u548c\u9519\u8bef\u5904\u7406\u5176\u5b9e\u662f\u4e00\u6837\u7684\uff0c\u5c31\u50cf\u96be\u4ee5\u9884\u77e5\u7a0b\u5e8f\u5c06\u629b\u51fa\u54ea\u4e9b\u9519\u8bef\u4e00\u6837\u96be\u4ee5\u77e5\u9053\u4e00\u6bb5\u7a0b\u5e8f\u9700\u8981\u54ea\u4e9b\u4f9d\u8d56\u3002effect-ts \u7ed9\u51fa\u4e86\u548c\u9519\u8bef\u5904\u7406\u4e00\u6837\u7684\u65b9\u6848\u3002</p>\n<p>\u6211\u521a\u521a\u4f7f\u7528 Effect \u91cd\u6784\u4e86 <a href=\"https://shenzilong.cn/%E6%83%B3%E6%B3%95/%E9%A1%B9%E7%9B%AE/OceanPress_js.html#20230905170531-6q68jov\" rel=\"nofollow\">OceanPress_js</a>\uff0c\u6574\u4e2a\u8fc7\u7a0b\u6781\u4e3a\u6d41\u7545\uff0c\u6211\u5bf9 Effect-ts \u4e86\u89e3\u5e76\u4e0d\u7b97\u900f\u5f7b\uff0c\u4f46\u662f\u4e00\u987f\u91cd\u6784\u4fee\u6539\u4e86\u7279\u522b\u591a\u7684\u5730\u65b9\uff0c\u7ed3\u679c\u6ca1\u6709\u51fa\u73b0\u4ec0\u4e48\u5927 bug \uff0c\u6574\u4e2a\u7a0b\u5e8f\u7684\u4f9d\u8d56\u548c\u8c03\u7528\u90fd\u66f4\u6e05\u6670\u4e86</p>\n<p>\u552f\u4e00\u51fa\u73b0\u7684 bug \u5c31\u662f ''+Effect \u8fd4\u56de\u5bf9\u8c61  \u8fd9\u6837\u7684\u8bed\u53e5\uff0cts \u4ed6\u4e0d\u4f1a\u62a5\u9519\uff0c\u4e0d\u7136\u7684\u8bdd\u8fd9\u6ce2\u91cd\u6784\u7b80\u76f4\u5b8c\u7f8e\u3002\u8fd9\u4e2a\u90fd\u4e0d\u7b97 effect \u7684\u95ee\u9898\u662f js \u7684\u95ee\u9898\u3002</p>\n<h2>effect \u901f\u67e5\u624b\u518c</h2>\n<p>\u4f7f\u7528 runPromise \u8fd0\u884c\u7a0b\u5e8f</p>\n<p>\u53ef\u4ee5\u4f7f\u7528 Context.empty().pipe(Context.add(...),...) \u8fd9\u6837\u7684\u65b9\u5f0f\u7ec4\u5408\u591a\u4e2a\u4f9d\u8d56\uff0c\u7136\u540e\u5c3d\u91cf\u5c06\u4f9d\u8d56\u62c6\u5206\u7684\u66f4\u7ec6\u4e00\u4e9b\uff0c\u8fd9\u6837\u65b9\u4fbf\u6267\u884c\u5c0f\u6bb5\u7a0b\u5e8f\u800c\u4e0d\u7528\u6ce8\u5165\u5927\u800c\u5168\u7684\u4f9d\u8d56</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/datadump", 
        "name": "datadump", 
        "avatar": "https://cdn.v2ex.com/avatar/373a/9420/284506_large.png?m=1724288412"
      }, 
      "url": "https://www.v2ex.com/t/1119438", 
      "date_modified": "2025-03-18T23:07:27+00:00", 
      "content_html": "<p>(1)\u7f16\u8bd1\u9519\u8bef</p>\n<pre><code>let xxx: string\nxxx?.length\n</code></pre>\n<p>(2)\u7f16\u8bd1\u6b63\u5e38</p>\n<pre><code>let xxx: string | undefined\nxxx?.length\n</code></pre>\n<p>\u7b2c\u4e8c\u4e2a\u4ee3\u7801\u4ecd\u7136\u53ea\u662f\u5b9a\u4e49\u4e86\u4e00\u4e2a\u7c7b\u578b\uff0c\u5e76\u6ca1\u6709\u8d4b\u503c\u3002\n\u6709\u6ca1\u6709\u4eba\u80fd\u901a\u4fd7\u6613\u61c2\u7684\u8bf4\u4e0b\uff1f\u4ece\u7f16\u8bd1\u5668\u7684\u89d2\u5ea6\u7406\u89e3</p>\n", 
      "date_published": "2025-03-18T13:36:58+00:00", 
      "title": "typescript \u8fbe\u4eba\u4e71\u5165", 
      "id": "https://www.v2ex.com/t/1119438"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Brunuh2Ville2", 
        "name": "Brunuh2Ville2", 
        "avatar": "https://cdn.v2ex.com/avatar/a6f6/117d/502926_large.png?m=1740596558"
      }, 
      "url": "https://www.v2ex.com/t/1117704", 
      "date_modified": "2025-03-12T00:21:39+00:00", 
      "content_html": "<p><img alt=\"\" class=\"embedded_image\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"https://wmimg.com/i/1319/2025/03/67d058133d1ea.png\"/></p>\n<hr/>\n<p>TypeScript \u5ba3\u5e03\u539f\u751f\u79fb\u690d\u8ba1\u5212\uff0c\u6027\u80fd\u5c06\u63d0\u5347 10 \u500d</p>\n<p>TypeScript \u56e2\u961f\u5ba3\u5e03\u5c06\u7f16\u8bd1\u5668\u53ca\u5de5\u5177\u94fe\u79fb\u690d\u81f3\u539f\u751f\u4ee3\u7801\uff08 Go \u8bed\u8a00\uff09\uff0c\u76ee\u6807\u5728 2025 \u5e74\u5b9e\u73b0\u91cc\u7a0b\u7891\u5f0f\u6027\u80fd\u7a81\u7834\u3002\u65b0\u7248\u672c tsc \u7f16\u8bd1\u5668\u5728\u4e3b\u6d41\u9879\u76ee\u6d4b\u8bd5\u4e2d\u5c55\u73b0\u51fa 10 \u500d\u901f\u5ea6\u63d0\u5347\uff1aVS Code \u4ee3\u7801\u5e93\u7c7b\u578b\u68c0\u67e5\u8017\u65f6\u4ece 77.8 \u79d2\u7f29\u81f3 7.5 \u79d2\uff0c\u7f16\u8f91\u5668\u9879\u76ee\u52a0\u8f7d\u65f6\u95f4\u66f4\u4ece 9.6 \u79d2\u4f18\u5316\u81f3 1.2 \u79d2\u3002\u8be5\u65b9\u6848\u8fd8\u5c06\u5185\u5b58\u5360\u7528\u964d\u4f4e\u7ea6 50%\u3002</p>\n<p>\u539f\u751f\u7248\u672c\u9884\u8ba1 2025 \u5e74\u4e2d\u53d1\u5e03\u547d\u4ee4\u884c\u68c0\u67e5\u5de5\u5177\uff0c\u5e74\u5e95\u5b8c\u6210\u5168\u529f\u80fd\u652f\u6301\u3002\u73b0\u6709 JavaScript \u4ee3\u7801\u5e93\uff08 TypeScript 6.x \uff09\u5c06\u4e0e\u539f\u751f\u7248\u672c\uff08 TypeScript 7.0 \uff0c\u4ee3\u53f7 \"Corsa\"\uff09\u5e76\u884c\u7ef4\u62a4\uff0c\u786e\u4fdd\u5e73\u7a33\u8fc7\u6e21\u3002\u5347\u7ea7\u540e\u5c06\u652f\u6301\u5b9e\u65f6\u5168\u9879\u76ee\u9519\u8bef\u68c0\u6d4b\u3001\u9ad8\u9636\u91cd\u6784\u529f\u80fd\uff0c\u5e76\u4e3a AI \u5f00\u53d1\u5de5\u5177\u63d0\u4f9b\u65b0\u57fa\u5efa\u3002</p>\n<p>\u56e2\u961f\u5c06\u4e8e 3 \u6708 13 \u65e5\u4e3e\u529e\u95ee\u7b54\u6d3b\u52a8\uff0c\u5f00\u53d1\u8005\u53ef\u901a\u8fc7 GitHub \u4ed3\u5e93\u8ffd\u8e2a\u8fdb\u5c55\u5e76\u53c2\u4e0e\u6d4b\u8bd5\u3002\u6b64\u6b21\u6027\u80fd\u8dc3\u8fc1\u88ab\u89c6\u4e3a\u5f00\u53d1\u4f53\u9a8c\u7684\u9769\u547d\u6027\u5347\u7ea7\uff0c\u6216\u5c06\u91cd\u5851\u73b0\u4ee3 TypeScript/JavaScript \u5f00\u53d1\u8303\u5f0f\u3002</p>\n<hr/>\n<p><a href=\"https://devblogs.microsoft.com/typescript/typescript-native-port/\" rel=\"nofollow\">https://devblogs.microsoft.com/typescript/typescript-native-port/</a></p>\n", 
      "date_published": "2025-03-11T15:39:23+00:00", 
      "title": "TypeScript \u5ba3\u5e03\u539f\u751f\u79fb\u690d\u8ba1\u5212\uff0c\u6027\u80fd\u5c06\u63d0\u5347 10 \u500d\uff1f", 
      "id": "https://www.v2ex.com/t/1117704"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/llej", 
        "name": "llej", 
        "avatar": "https://cdn.v2ex.com/avatar/b4e7/fabc/451595_large.png?m=1596437487"
      }, 
      "url": "https://www.v2ex.com/t/1112212", 
      "title": "#\u7b14\u8bb0#\u66f4\u597d\u7684 ts \u91cd\u8f7d\u58f0\u660e\u65b9\u6cd5", 
      "id": "https://www.v2ex.com/t/1112212", 
      "date_published": "2025-02-18T02:04:54+00:00", 
      "content_html": "<pre><code class=\"language-typescript\">/** \u66f4\u65b0\u6570\u636e */\nfunction fn(op:'updated',id:number):any\n/** \u521b\u5efa\u6570\u636e */\nfunction fn(op:'created'):any\n/** \u5982\u679c\u5728\u4e0a\u9762\u7684\u91cd\u8f7d\u5199\u4e86 jsdoc \u90a3\u4e48\u8fd9\u91cc\u7684 jsdoc \u5c06\u65e0\u6cd5\u770b\u5230\n * \u4f7f\u7528\u8fd9\u79cd\u5f62\u5f0f\u76f8\u6bd4\u4e0b\u9762\u8fd9\u79cd\u66f4\u5e38\u89c1\u7684\u6211\u611f\u89c9\u7c7b\u578b\u63cf\u8ff0\u66f4\u51c6\u786e\u4e00\u4e9b\n * \u5e76\u4e14\u4e0a\u9762\u4e24\u4e2a\u91cd\u8f7d\u58f0\u660e\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4e0d\u7528\uff08\u4f46\u5982\u679c\u8981\u9488\u5bf9\u4e0d\u540c\u91cd\u8f7d\u5199 jsdoc \u7684\u8bdd\u8fd8\u662f\u8981\u6709\u91cd\u8f7d\u58f0\u660e\u7684\uff09\n * ```ts\n * function fn(op:'created'|'updated',id?:number){}\n * ```\n */\nfunction fn(...[op,id]:['created']|['updated',number]){\n}\nfn('created')\nfn('created',1) //Argument of type '\"created\"' is not assignable to parameter of type '\"updated\"'.\nfn('updated') //Argument of type '\"updated\"' is not assignable to parameter of type '\"created\"'.(2345)\nfn('updated',1)\n</code></pre>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/llej", 
        "name": "llej", 
        "avatar": "https://cdn.v2ex.com/avatar/b4e7/fabc/451595_large.png?m=1596437487"
      }, 
      "url": "https://www.v2ex.com/t/1112033", 
      "date_modified": "2025-02-17T07:31:10+00:00", 
      "content_html": "<pre><code class=\"language-typescript\">const opType = 'create' as 'create' | 'updated'\n\nif (opType === 'create') {\n    // create....\n} else if (opType === 'updated') {\n    // updated....\n} else {\n    opType satisfies never\n}\n\nconst opTypeNew = 'create' as 'create' | 'updated' | 'delete'\nif (opTypeNew === 'create') {\n    // create....\n} else if (opTypeNew === 'updated') {\n    // updated....\n} else {\n    // \u8fd9\u91cc\u5c31\u4f1a\u62a5\u9519\n    // \u6bcf\u6b21\u5728\u7a77\u4e3e\u6240\u6709\u53ef\u80fd\u6027\u7684\u65f6\u5019\u5728\u6700\u540e\u7684\u5206\u652f\u4f7f\u7528\u8fd9\u79cd\u6280\u5de7\u53ef\u4ee5\u4f7f\u5f97\u5f53\u6211\u4eec\u9057\u6f0f\u4e86\u67d0\u4e9b\u60c5\u51b5\u7684\u65f6\u5019\u4f1a\u63d0\u793a\u6211\u4eec\n    // Type '\"delete\"' does not satisfy the expected type 'never'. \n    opTypeNew satisfies never\n}\n</code></pre>\n<p>\u8bb0\u5f97\u4ee5\u524d\u770b\u5230\u5c24\u96e8\u6eaa\u8bb2\u8fc7\u8fd9\u4e2a\u6280\u5de7\uff0c\u4e0d\u8fc7\u5f53\u65f6\u8fd8\u6ca1\u6709 satisfies \u5173\u952e\u5b57\uff0c\u6240\u4ee5\u521a\u521a\u7a81\u7136\u60f3\u5230\u8fd9\u6837\u53ef\u4ee5\u66f4\u7b80\u6d01,\u8f6c\u8bd1\u7684 js \u4ee3\u7801\u4e5f\u66f4\u77ed</p>\n", 
      "date_published": "2025-02-17T07:30:56+00:00", 
      "title": "\u4f7f\u7528 satisfies \u5b9e\u73b0\u7a77\u4e3e\u7c7b\u578b\u4fdd\u62a4", 
      "id": "https://www.v2ex.com/t/1112033"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/jeremye", 
        "name": "jeremye", 
        "avatar": "https://cdn.v2ex.com/gravatar/69762380624399f9a580f7dfb2e683dd?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1094984", 
      "date_modified": "2024-12-04T13:38:13+00:00", 
      "content_html": "<p>\u76ee\u524d\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u53ef\u4ee5\u6b63\u5e38\u8fdb\u884c\u7684\u7c7b\u578b\u63a8\u5bfc\uff0c\u4f46\u6bcf\u5b9a\u4e49\u4e00\u4e2a <code>item</code> \u90fd\u9700\u8981\u8c03\u7528\u4e00\u6b21 <code>defineItem</code>\uff0c\u60f3\u8981\u5b9e\u73b0\u4e00\u4e2a <code>defineConfig</code> \u65b9\u6cd5\uff0c\u7701\u7565\u6389 <code>defineItem</code>\uff0c\u540c\u65f6\u4fdd\u7559\u539f\u5148\u7684\u7c7b\u578b\u63a8\u5bfc\u3002</p>\n<pre><code class=\"language-typescript\">interface Options&lt;T&gt; {\n  a: () =&gt; T;\n  b: (p: T) =&gt; void;\n}\n\nfunction defineItem&lt;T&gt;(options: Options&lt;T&gt;) {\n  return options;\n}\n\nconst config = {\n  item1: defineItem({\n    a: () =&gt; ({ id: 1 }),\n    b: (params) =&gt; {}, // params \u7c7b\u578b\u662f { id: number }\n  }),\n  item2: defineItem({\n    a: () =&gt; ({ name: '1' }),\n    b: (params) =&gt; {}, // params \u7c7b\u578b\u662f { name: string }\n  }),\n};\n</code></pre>\n<p>\u9884\u671f\u7684\u6548\u679c</p>\n<pre><code class=\"language-typescript\">const config = defineConfig({\n  item1: {\n    a: () =&gt; ({ id: 1 }),\n    b: (params) =&gt; {}, // params \u7c7b\u578b\u662f { id: number }\n  },\n  item2: {\n    a: () =&gt; ({ name: '1' }),\n    b: (params) =&gt; {}, // params \u7c7b\u578b\u662f { name: string }\n  },\n});\n</code></pre>\n", 
      "date_published": "2024-12-04T08:12:52+00:00", 
      "title": "\u8bf7\u6559\u4e00\u4e2a TS \u95ee\u9898\uff0c\u4e0d\u77e5\u80fd\u5426\u5b9e\u73b0", 
      "id": "https://www.v2ex.com/t/1094984"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/ljzxloaf", 
        "name": "ljzxloaf", 
        "avatar": "https://cdn.v2ex.com/gravatar/5b670ea91cb4c0b70c03e42817ebfc83?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1092604", 
      "title": "\u88c5\u9970\u5668\u80fd\u4e0d\u80fd\u88c5\u9970\u7c7b\u7684\u6240\u6709\u65b9\u6cd5", 
      "id": "https://www.v2ex.com/t/1092604", 
      "date_published": "2024-11-25T15:54:20+00:00", 
      "content_html": "\u4e0d\u592a\u4e86\u89e3 ts \uff0c\u611f\u89c9\u7ed9\u6bcf\u4e2a\u65b9\u6cd5\u90fd\u6253\u6ce8\u89e3\u592a\u9ebb\u70e6\u4e86\uff0c\u80fd\u4e0d\u80fd\u76f4\u63a5\u6253\u7c7b\u4e0a"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yandif", 
        "name": "yandif", 
        "avatar": "https://cdn.v2ex.com/avatar/2eca/34e7/559856_large.png?m=1731053342"
      }, 
      "url": "https://www.v2ex.com/t/1087803", 
      "title": "TypeSciprt \u7c7b\u578b\u63a8\u65ad\uff0c\u5982\u4f55\u8fdb\u4e00\u6b65\u6536\u7a84\u7c7b\u578b\uff1f", 
      "id": "https://www.v2ex.com/t/1087803", 
      "date_published": "2024-11-08T08:17:14+00:00", 
      "content_html": "<p>\u4ee5\u4e0b\u4ee3\u7801\u4e2d value \u53ea\u80fd\u63a8\u65ad\u51fa\u662f 1 \uff5c 2 \uff5c 3 \u3002</p>\n<p>\u60f3\u95ee\u4e0b\u5927\u4f6c\u4eec\uff0cTypeSciprt \u76ee\u524d\u53ea\u4e0d\u652f\u6301\u5728 <code>if(k === 'a')</code> \u65f6\u63a8\u65ad\u51fa value \u4e3a 1 \u3002</p>\n<p>\u6216\u8005\u6709\u6ca1\u6709\u4ec0\u4e48\u641c\u7d22\u7684\u5173\u952e\u8bcd\u3002\u67e5\u4e86\u534a\u5929\u6ca1\u627e\u5230\u600e\u4e48\u66f4\u4e00\u6b65\u6536\u7a84\u8fd9\u4e2a\u7c7b\u578b\u3002</p>\n<pre><code class=\"language-ts\">const map = {\n  a: 1,\n  b: 2,\n  c: 3,\n} as const;\n\ntype Map = typeof map;\n\nfunction fn&lt;K extends keyof Map&gt;(k: K, value: Map[K]) {\n  if (k === 'a') {\n    console.log(value); //value: 1 | 2 | 3\n  }\n\n  if (k === 'b') {\n    console.log(value);\n  }\n\n  if (k === 'c') {\n    console.log(value);\n  }\n}\n</code></pre>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/xxss0903", 
        "name": "xxss0903", 
        "avatar": "https://cdn.v2ex.com/gravatar/99176062fe068c52d6e774d1d11b538c?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1082613", 
      "date_modified": "2024-10-22T14:15:32+00:00", 
      "content_html": "<p>\u6700\u8fd1\u5199\u4e86\u4e00\u4e2a\u5e93\u53d1\u5e03\u5230\u4e86 npm\n\u6e90\u7801\u4f7f\u7528\u7684 TypeScript \u5f00\u53d1\u7684\uff0c\u7136\u540e\u7528\u4e86 vite \u8fdb\u884c\u6253\u5305\uff0c\u73b0\u5728\u6211\u5df2\u7ecf\u53d1\u5e03\u5230 npm \u4e0a\u9762\u4e86\n\u4f46\u662f\u5728\u4f7f\u7528\u7684\u65f6\u5019\u5f15\u5165\u5305\u7684\u65f6\u5019\u4f1a\u51fa\u73b0 ts \u7684\u9519\u8bef\uff0c\u56e0\u4e3a\u6253\u5305\u4e4b\u540e\u6ca1\u6709 dts \u6587\u4ef6\n\u4e0d\u77e5\u9053\u8981\u600e\u4e48\u7ed9\u6253\u5305\u5230 npm \u7684\u5305\u6dfb\u52a0\u9700\u8981\u66b4\u9732\u7684 dts \u6587\u4ef6\n\u8fd9\u4e2a\u662f npm \u7684\u5305\u5730\u5740\uff1a <a href=\"https://www.npmjs.com/package/liteofd\" rel=\"nofollow\">https://www.npmjs.com/package/liteofd</a>\n\u4e0b\u9762\u662f\u6211\u5728 demo \u9879\u76ee\u91cc\u9762\u5f15\u5165\u7684\u62a5\u9519</p>\n<pre><code class=\"language-TypeScript\">import { LiteOfd, OfdDocument } from 'liteofd'\n</code></pre>\n<pre><code class=\"language-JavaScript\">Could not find a declaration file for module 'liteofd'. 'node_modules/liteofd/dist/liteofd.es.js' implicitly has an 'any' type.\n  There are types at 'node_modules/liteofd/dist/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The 'liteofd' library may need to update its package.json or typings.\n</code></pre>\n<p>\u4e0b\u9762\u7684\u56fe\u662f\u6253\u5305\u53d1\u5e03\u5230 npm \u4e0a\u9762\u7684\u7ed3\u6784\n<img alt=\"\u7ed3\u6784 1\" class=\"embedded_image\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"https://i.imgur.com/9XHuvrs.png\"/>\n<img alt=\"\u7ed3\u6784 2\" class=\"embedded_image\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"https://i.imgur.com/cM44fnc.png\"/>\n\u6211\u5728\u7f51\u4e0a\u4e5f\u67e5\u8be2\u4e86\uff0c\u4f46\u662f\u56e0\u4e3a\u4e0d\u662f\u524d\u7aef\u5f00\u53d1\uff0c\u6240\u4ee5\u4e00\u76f4\u6ca1\u5f04\u597d\u5982\u4f55\u7ed9\u8fd9\u4e2a\u9879\u76ee\u6dfb\u52a0 dts\n\u5e0c\u671b\u719f\u6089 TypeScript \u7684\u5404\u4f4d\u5e2e\u5e2e\u5fd9\u5e2e\u6211\u770b\u770b\u6211\u8981\u600e\u4e48\u6539\u9879\u76ee\u6dfb\u52a0 dts \u6587\u4ef6\u8ba9\u7528\u6237\u5f15\u7528\u5305\u4e0d\u4f1a\u62a5\u9519\nps:dts-gen \u6211\u4e5f\u5b89\u88c5\u5e76\u6309\u7167\u7f51\u4e0a\u7684\u4f7f\u7528\u8fd8\u662f\u4e0d\u884c\uff0c\u5c31\u62a5\u9519\u8bf4 module \u7684\u95ee\u9898</p>\n", 
      "date_published": "2024-10-22T08:22:12+00:00", 
      "title": "TypeScript \u9879\u76ee\u6253\u5305\u53d1\u5e03\u5230 npm\uff0c\u5982\u4f55\u7ed9\u65b9\u6cd5\u548c\u63a5\u53e3\u6dfb\u52a0 dts", 
      "id": "https://www.v2ex.com/t/1082613"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/zhbhun", 
        "name": "zhbhun", 
        "avatar": "https://cdn.v2ex.com/gravatar/916b4b3d4e6263a4ebd7af9b33e9d770?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1081497", 
      "date_modified": "2024-10-19T12:17:09+00:00", 
      "content_html": "<p>\u6700\u8fd1\u5728\u5b66\u4e60\u5f00\u53d1\u5ba2\u6237\u7aef\u76f8\u5173\u7684\u529f\u80fd\uff0c\u53d1\u73b0 Kotlin \u548c Swift \u8981\u5b9e\u73b0\u6cdb\u5316\u7684\u9ad8\u9636\u51fd\u6570\u4e0d\u592a\u5bb9\u6613\u3002\u6bd4\u5982\u6211\u8981\u5b9e\u73b0\u4e00\u4e2a\u9ad8\u9636\u51fd\u6570\uff0c\u9700\u8981\u5c06\u4f20\u5165\u7684\u4e00\u4e2a async \u51fd\u6570\u8f6c\u4e3a\u4e32\u884c\u6267\u884c\u7684\u51fd\u6570\uff0c\u5fc5\u987b\u7b49\u5f85\u524d\u4e00\u4e2a\u4efb\u52a1\u5b8c\u6210\u540e\u624d\u80fd\u5f00\u59cb\u4e0b\u4e00\u4e2a\u3002\u4f7f\u7528 TS \u53ef\u4ee5\u8fd9\u4e48\u505a\uff1a</p>\n<pre><code class=\"language-ts\">function sequentialize&lt;T extends (...args: any[]) =&gt; Promise&lt;any&gt;&gt;(\n  asyncFn: T\n): (...args: Parameters&lt;T&gt;) =&gt; ReturnType&lt;T&gt; {\n  let queue: Promise&lt;void&gt; = Promise.resolve(); // \u521d\u59cb\u5316\u961f\u5217\n  return function (...args: Parameters&lt;T&gt;): ReturnType&lt;T&gt; {\n    const result = queue.then(() =&gt; asyncFn(...args)); // \u5c06\u5f02\u6b65\u4efb\u52a1\u6dfb\u52a0\u5230\u961f\u5217\u4e2d\n    queue = result.catch(() =&gt; {}); //\u6355\u83b7\u9519\u8bef,\u9632\u6b62\u961f\u5217\u4e2d\n    return result as ReturnType&lt;T&gt;; //\u786e\u4fdd\u8fd4\u56de\u7c7b\u578b\u4e0e\u539f\u59cb\u51fd\u6570\u4e00\u81f4\n  };\n}\n\nasync function plus(a: number, b: number): Promise&lt;number&gt; {\n  await new Promise&lt;void&gt;((resolve) =&gt; {\n    setTimeout(() =&gt; {\n      resolve();\n      console.log(performance.now(), a, b);\n    }, 1000);\n  });\n  return a + b;\n}\n\nconst sequentializePlus = sequentialize(plus);\n\n</code></pre>\n<p>\u4f46\u8fd9\u5728 Swift \u548c Kotlin \u91cc\u4e0d\u592a\u597d\u5904\u7406\uff0c\u5b83\u4eec\u6ca1\u6cd5\u4f20\u5165\u52a8\u6001\u7684\u51fd\u6570\uff0c\u5e76\u5305\u88c5\u540e\u8fd4\u56de\u540c\u7c7b\u578b\u7684\u51fd\u6570\u3002\u60f3\u95ee\u4e0b\uff0c\u5982\u679c\u50cf Swift \u548c Kotlin \u8fd9\u6837\u7684\u5f3a\u7c7b\u578b\u8bed\u8a00\u8981\u5b9e\u73b0\u8fd9\u6837\u7684\u8bed\u6cd5\uff0c\u662f\u5426\u4f1a\u5b58\u5728\u4ec0\u4e48\u9650\u5236\uff1f\u662f\u5426\u662f\u56e0\u4e3a TS \u7f16\u8bd1\u540e\u7684 JS \u662f\u52a8\u6001\u7c7b\u578b\u7684\uff0c\u624d\u652f\u6301\u8fd9\u79cd\u7c7b\u578b\u63a8\u5bfc\uff08\u8fd0\u884c\u4e0d\u4f1a\u51fa\u95ee\u9898\uff09\uff0c\u800c Swift \u548c Kotlin \u65e0\u6cd5\u505a\u5230\uff1f</p>\n", 
      "date_published": "2024-10-18T06:18:06+00:00", 
      "title": "TypeScript \u7c7b\u578b\u63a8\u5bfc\u771f\u5f3a\u5927\u3002", 
      "id": "https://www.v2ex.com/t/1081497"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/rookiemaster", 
        "name": "rookiemaster", 
        "avatar": "https://cdn.v2ex.com/avatar/b368/6614/659911_large.png?m=1769416716"
      }, 
      "url": "https://www.v2ex.com/t/1076582", 
      "title": "\u4e3a\u5565\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801 TS \u4e0d\u62a5\u9519", 
      "id": "https://www.v2ex.com/t/1076582", 
      "date_published": "2024-09-28T11:26:18+00:00", 
      "content_html": "<p>\u4e0b\u9762\u8fd9\u6bb5 TS \u4ee3\u7801\uff0cret \u91cc\u9762\u7684\u6570\u503c\u662f 1 \uff0c\u6240\u4ee5\u8fd4\u56de\u7684\u5e94\u8be5\u662f Promise&lt;number&gt;\uff0c\u4e0d\u662f\u8981\u6c42\u7684 Promise&lt;loginResponseData&gt;\uff0c\u4e3a\u5565\u8fd0\u884c\u7684\u65f6\u5019\u6ca1\u9519.</p>\n<pre><code class=\"language-TypeScript\">export function reqLogin(data: loginForm): Promise&lt;loginResponseData&gt; {\n  const ret = request.post&lt;any, loginResponseData&gt;(API.LOGIN_URL, data)\n  ret.then((result) =&gt; console.log(result)) // 1\n  return ret\n}\n</code></pre>\n<p>\u8fd9\u662f\u5c01\u88c5 axios \u540e, \u54cd\u5e94\u62e6\u622a\u5668\u7684\u4ee3\u7801, \u54cd\u5e94\u8fd4\u56de\u7684 1</p>\n<pre><code class=\"language-TypeScript\">request.interceptors.response.use(\n  (response) =&gt; {\n    const a: any = 1\n    return a\n  },\n  (error) =&gt; {\n    ElMessage('oops')\n    return new Promise(error)\n  }\n)\n</code></pre>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/fhiutc", 
        "name": "fhiutc", 
        "avatar": "https://cdn.v2ex.com/avatar/3092/b300/142999_large.png?m=1775026975"
      }, 
      "url": "https://www.v2ex.com/t/1075225", 
      "title": "ts \u7c7b\u578b\u7ea6\u675f+\u8bf7\u6c42\u53c2\u6570\u6821\u9a8c+\u81ea\u52a8\u751f\u6210 openapi/swagger \u6587\u6863\uff0c\u8fd9\u4e09\u8005\u76ee\u524d\u6709\u6574\u5408\u4e3a\u4e00\u4f53\u7684\u6700\u4f73\u5b9e\u8df5\u5417", 
      "id": "https://www.v2ex.com/t/1075225", 
      "date_published": "2024-09-23T16:06:31+00:00", 
      "content_html": "<p>\u5e73\u65f6\u5728\u7528 nodejs \u5f00\u53d1\u540e\u7aef\uff0c\u603b\u89c9\u5f97\u8fd9\u4e09\u4e2a\u4e1c\u897f\u662f\u53ef\u4ee5\u53ea\u5199\u5176\u4e2d\u4e00\u4e2a\uff0c\u7136\u540e\u81ea\u52a8\u751f\u6210\u53e6\u5916\u4e24\u4e2a\u7684\n\u76ee\u524d\u6709\u8fd9\u65b9\u9762\u7684\u6700\u4f73\u5b9e\u8df5\u5417\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/june4", 
        "name": "june4", 
        "avatar": "https://cdn.v2ex.com/avatar/4555/12c1/661756_large.png?m=1767580261"
      }, 
      "url": "https://www.v2ex.com/t/1074632", 
      "date_modified": "2024-09-21T07:56:19+00:00", 
      "content_html": "<pre><code class=\"language-js\">type Obj = { xxxFoo?: number ,xxxBar?: number }\ndeclare function func(obj: Obj): void\ntype Suffix = 'Foo'\nconst s: Suffix = 'Foo'\nfunc({ \n    [`xxx${'Bar'}`]: 2, \n    [`yyy${'Foo'}`]: 2,  // \u8fd9\u884c\u4f1a\u62a5\u9519\uff0c\u7b26\u5408\u9884\u671f\n    [`yyy${s}`]: 3, // \u4f46\u8fd9\u884c\u4e3a\u4ec0\u4e48\u4e0d\u4f1a\u62a5\u9519\uff1f\uff1f\uff1f\uff01\uff01\uff01\n    [`xxx${s}` satisfies keyof Obj]: 4 \n})\n</code></pre>\n<p>\u4e3a\u4ec0\u4e48\u90a3\u884c\u4e0d\u4f1a\u62a5\u9519\uff0c\u548c\u4e0a\u4e00\u884c\u5230\u5e95\u6709\u4ec0\u4e48\u533a\u522b\u554a\uff1f\u6211\u4e5f\u662f\u670d\u4e86\uff0c\u6240\u6709\u4e0a\u706b\u7684\u5730\u65b9\u90fd\u4e0a\u5728 TypeScript \u4e0a\u3002</p>\n", 
      "date_published": "2024-09-21T07:55:26+00:00", 
      "title": "TypeScript \u80fd\u4e0d\u80fd\u522b\u8fd9\u4e48\u53e4\u602a\uff0c\u8fd9\u884c\u4e3a\u4ec0\u4e48\u4f1a\u62a5\u9519\u5462\uff1f", 
      "id": "https://www.v2ex.com/t/1074632"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/june4", 
        "name": "june4", 
        "avatar": "https://cdn.v2ex.com/avatar/4555/12c1/661756_large.png?m=1767580261"
      }, 
      "url": "https://www.v2ex.com/t/1069519", 
      "date_modified": "2024-09-02T02:28:37+00:00", 
      "content_html": "<p>\u670d\u4e86 TypeScript \u8fd9\u8d27\u4e86\uff0c\u7b26\u5408\u6211\u5bf9\u5fae\u8f6f\u7684\u523b\u677f\u5370\u8c61\uff0c\u6700\u8fd1\u51e0\u5e74\u4f3c\u4e4e\u6bcf\u6b21\u78b0\u5230\u770b\u4e0d\u660e\u767d\u7684\u8bed\u6cd5\u51fa\u9519\uff0c\u90fd\u662f\u5728 TypeScript \uff0c\u8fd9\u8d27\u65e0\u6570\u7ec6\u8282\u592a\u5fae\u5999\u4e86\u3002</p>\n<pre><code class=\"language-js\">interface Elements {\n  div: { id: number; name?: string; color: string; x: string }\n  a: { id: number; name?: string; href: string; x: string }\n}\n\ndeclare function getProps&lt;T extends Record&lt;any, any&gt;&gt;(obj: T, keys: (keyof T)[]): void\n\nfunction Foo&lt;T extends 'div' | 'a'&gt;(tag: T, props: Omit&lt;Elements[T], 'x'&gt;) {\n  // \u8fd9\u884c\u62a5\u9519 Type 'string' is not assignable to type 'Exclude&lt;keyof Elements[T], \"x\"&gt;'\n  getProps(props, ['id'])\n}\nFoo('a', { id: 1, href: '#' })\n\n// \u6211\u4ee5\u4e3a\u662f\u56e0\u4e3a Omit \u53ea\u80fd\u653e\u5355\u4e2a\u5bf9\u8c61\uff0c\u8bd5\u4e86\u4e0b\u591a\u4e2a\u4e5f\u884c\u554a\u3002\ntype kkk = Omit&lt;Elements['div' | 'a'], 'x'&gt;\n\u628a `function Foo&lt;T extends 'div' | 'a'&gt;(tag: T, props: Omit&lt;Elements[T], 'x'&gt;)` \n\u6539\u6210 `function Foo&lt;T extends 'div' | 'a'&gt;(tag: T, props: Omit&lt;Elements['div' | 'a'], 'x'&gt;)` \u5c31\u4e0d\u4f1a\u62a5\u9519\u3002\n\u90a3\u8fd9\u4e2a `T` \u4e0d\u5c31\u662f `'div' | 'a'` \u5417\uff1f\u8fd9 tm \u4e8c\u8005\u5230\u5e95\u6709\u4ec0\u4e48\u5fae\u5999\u533a\u522b\u5bfc\u81f4\u4ee3\u7801\u4e00\u4e2a\u62a5\u9519\u4e00\u4e2a\u6ca1\u9519\uff1f\n</code></pre>\n", 
      "date_published": "2024-09-02T02:28:03+00:00", 
      "title": "\u600e\u4e48\u6bcf\u6b21\u78b0\u5230\u60f3\u4e0d\u901a\u7684\u4ee3\u7801\u884c\u90fd\u51fa\u5728 TypeScript\ud83d\ude22 \u8fd9\u884c\u5230\u5e95\u54ea\u91cc\u6709\u95ee\u9898\uff1f", 
      "id": "https://www.v2ex.com/t/1069519"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/datadump", 
        "name": "datadump", 
        "avatar": "https://cdn.v2ex.com/avatar/373a/9420/284506_large.png?m=1724288412"
      }, 
      "url": "https://www.v2ex.com/t/1068807", 
      "date_modified": "2024-08-31T02:08:43+00:00", 
      "content_html": "<p>\u65e9\u671f\u662f\u7528\u7684 js \uff0c\u56e0\u4e3a\u7c7b\u578b\u7cfb\u7edf\u51fa\u4e86\u5f88\u591a\u6d6a\u8d39\u65f6\u95f4\u7684 bug \uff0c\u540e\u6765\u8ff7\u8ff7\u7cca\u7cca\u7528\u4e86\u5927\u534a\u5e74\uff0c\u4ee5\u4e3a\u4e00\u77e5\u534a\u89e3\u4e86\u3002</p>\n<p>\u8fd9\u51e0\u5929\u5f00\u59cb\u64b8\u8fd9\u4e2a ts \u7684\u7c7b\u578b\u4f53\u64cd\uff0c\u7b80\u5355\u7684\u90fd\u64b8\u7684\u6218\u6218\u5162\u5162\uff0c\u6c57\u5982\u96e8\u4e0b\uff0c\u5404\u4f4d\u5927\u795e\u6765\u6311\u6218\u4e0b\uff1a\uff08\u5b83\u8fd8\u6709\u4e2a vscode \u63d2\u4ef6\uff09\n<a href=\"https://github.com/type-challenges/type-challenges/blob/main/README.zh-CN.md\" rel=\"nofollow\">https://github.com/type-challenges/type-challenges/blob/main/README.zh-CN.md</a></p>\n", 
      "date_published": "2024-08-29T09:36:33+00:00", 
      "title": "\u4f4e\u4f30\u4e86 typescript \u7684\u96be\u5ea6", 
      "id": "https://www.v2ex.com/t/1068807"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/shintendo", 
        "name": "shintendo", 
        "avatar": "https://cdn.v2ex.com/avatar/8627/ca70/274063_large.png?m=1762849953"
      }, 
      "url": "https://www.v2ex.com/t/1067621", 
      "title": "\u524d\u7aef\u5199 nestjs \u540e\u7aef\uff0c\u7528 TypeORM \u65f6\u611f\u5230\u975e\u5e38\u56f0\u60d1\uff0c\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u6211\u7684\u7406\u89e3\u6709\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/1067621", 
      "date_published": "2024-08-25T06:57:19+00:00", 
      "content_html": "\u5f53\u6211\u628a\u4e00\u4e2a\u8868\u5b57\u6bb5\u5b9a\u4e49\u4e3a nullable: true \u6216\u8005 nullable: false \u7684\u65f6\u5019\uff0c\u4f3c\u4e4e\u5e76\u4e0d\u5f71\u54cd\u8fd9\u4e2a\u5b57\u6bb5\u5728\u4ee3\u7801\u91cc\u662f optional \u8fd8\u662f required \uff1f\u5982\u679c\u6211\u4e0d\u901a\u8fc7 ORM \u81ea\u52a8\u5efa\u8868\uff0c\u800c\u662f\u81ea\u5df1\u5728 navicat \u91cc\u5efa\u8868\uff0c\u90a3\u662f\u4e0d\u662f TypeORM \u91cc\u9762\u7684 @<a target=\"_blank\" href=\"/member/Column\" rel=\"nofollow noopener\">Column</a> \u88c5\u9970\u5668\u53c2\u6570\u5c31\u6ca1\u6709\u4efb\u4f55\u610f\u4e49\uff1f<br /><br />\u53e6\u4e00\u4e2a\u66f4\u5927\u7684\u7591\u95ee\uff1a\u6211\u5b9a\u4e49\u4e00\u4e2a Entity \uff0c\u6240\u6709\u5b57\u6bb5\u90fd\u662f Not Null \u7684\uff0c\u7c7b\u578b\u4e5f\u90fd\u662f required \u7684\uff0c\u7ed3\u679c TypeORM \u5141\u8bb8\u6211\u5f80\u8fd9\u4e2a\u8868\u91cc\u4fdd\u5b58\u7a7a\u5bf9\u8c61\uff1f\u7b49\u7740\u6570\u636e\u5e93\u62a5\u9519\uff1f<br />\u8fd9\u4e2a\u7c7b\u578b\u5b89\u5168\u4f53\u73b0\u5728\u54ea\u91cc\uff0c\u6211\u771f\u7684\u5f88\u8ff7\u60d1\uff0c\u7f51\u4e0a\u641c\u4e86\u4e00\u5708\u6ca1\u770b\u5230\u6709\u4eba\u95ee\u8fd9\u4e2a\uff0c\u4e0d\u7981\u6000\u7591\u662f\u6211\u7684\u7406\u89e3\u6709\u95ee\u9898<br /><br /><a target=\"_blank\" href=\"https://i.imgur.com/UXze9bI.png\" rel=\"nofollow noopener\" target=\"_blank\"><img src=\"https://i.imgur.com/UXze9bI.png\" class=\"embedded_image\" rel=\"noreferrer\"></a><br /><a target=\"_blank\" href=\"https://i.imgur.com/CoyUtkq.png\" rel=\"nofollow noopener\" target=\"_blank\"><img src=\"https://i.imgur.com/CoyUtkq.png\" class=\"embedded_image\" rel=\"noreferrer\"></a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/d3George", 
        "name": "d3George", 
        "avatar": "https://cdn.v2ex.com/avatar/8d0b/b2b0/662224_large.png?m=1717075183"
      }, 
      "url": "https://www.v2ex.com/t/1066694", 
      "date_modified": "2024-08-21T07:45:31+00:00", 
      "content_html": "<ol>\n<li>ToTal TypeScript : <a href=\"https://www.totaltypescript.com/\" rel=\"nofollow\">https://www.totaltypescript.com/</a></li>\n<li>Type Level TypeScript: <a href=\"https://type-level-typescript.com/\" rel=\"nofollow\">https://type-level-typescript.com/</a></li>\n<li>Type Hero: <a href=\"https://typehero.dev/\" rel=\"nofollow\">https://typehero.dev/</a></li>\n<li>typescript-book: <a href=\"https://gibbok.github.io/typescript-book/\" rel=\"nofollow\">https://gibbok.github.io/typescript-book/</a></li>\n</ol>\n<p><a href=\"https://discord.com/channels/1215196840161574952/1275667334530596999\" rel=\"nofollow\">https://discord.com/channels/1215196840161574952/1275667334530596999</a></p>\n", 
      "date_published": "2024-08-21T04:13:53+00:00", 
      "title": "\u6211\u5217\u4e3e\u4e86\u5e02\u9762\u4e0a\u6700\u597d\u7684\u51e0\u4e2a TypeScript \u6559\u7a0b\uff0c \u60f3\u6df1\u5165\u5b66\u4e60 TypeScript \u7684\u540c\u5b66\u4ee5\u540e\u4e0d\u7528\u8d70\u5f2f\u8def\u4e86", 
      "id": "https://www.v2ex.com/t/1066694"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/waiaan", 
        "name": "waiaan", 
        "avatar": "https://cdn.v2ex.com/avatar/a703/deb0/206370_large.png?m=1655257935"
      }, 
      "url": "https://www.v2ex.com/t/1056453", 
      "title": "\u8fd9\u6837\u7684\u51fd\u6570\u7c7b\u578b\u5b9a\u4e49\u5728 ts \u91cc\u9762\u53eb\u4ec0\u4e48\uff1f", 
      "id": "https://www.v2ex.com/t/1056453", 
      "date_published": "2024-07-11T01:43:08+00:00", 
      "content_html": "<pre><code class=\"language-js\">type ClassA = {\n  prop1: string\n  prop2: number\n  prop3?: string\n}\n\nconst a = {\n  prop4: '123',\n  // \u8fd9\u4e2a prop5 \u662f\u51fd\u6570\u7684\u7c7b\u578b\u5b9a\u4e49\u5417\uff1f\n  prop5: (): ClassA =&gt; {\n    return {\n      prop1: '1',\n      prop2: 2\n    }\n  }\n}\n</code></pre>\n<p>\u5982\u4f55\u7406\u89e3\u8fd9\u4e2a prop5 \u7684\u7c7b\u578b\u5b9a\u4e49\uff1f\u6709\u6ca1\u6709\u76f8\u5173\u6587\u6863\u53ef\u4ee5\u5b66\u4e60\u4e00\u4e0b\uff1f\u8c22\u8c22\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/hahaFck", 
        "name": "hahaFck", 
        "avatar": "https://cdn.v2ex.com/gravatar/3f76d95c8badee4798edbe90ca41c87a?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1052423", 
      "date_modified": "2024-06-25T07:17:07+00:00", 
      "content_html": "\u6bd4\u5982\u6211\u5b9a\u4e49\u4e86\u4e00\u4e2a\u7c7b\u578b\u5e26\u6709\u6cdb\u578b\u53c2\u6570&lt;T&gt;<br /><br />```typescript<br />export interface ReportTreeNode&lt;T extends BaseDataType&gt; {<br />  data: T<br />  children: ReportTreeNode&lt;T&gt;[]<br />  relationshipWithParent: RelationshipWithParent<br />  nodeType: NodeType<br />  cellInfo?: CellInfo<br />}<br />```<br /><br />\u4f46\u662f\u6211\u5728\u5199\u4e00\u4e9b\u5176\u4ed6\u5de5\u5177\u65b9\u6cd5\u65f6\uff0c\u662f\u4e0d\u5173\u5fc3\u5177\u4f53\u7c7b\u578b T \u7684\uff0c\u5728 java \u4e2d\u8fd9\u4e2a\u79cd\u60c5\u51b5\u53ef\u4ee5\u5199\u95ee\u53f7`?`\u4ee3\u66ff\uff0c\u4f46\u662f typescript \u4e0d\u884c\uff0c\u5982\u679c\u6211\u5199 any \u7684\u8bdd\uff0ceslint \u53c8\u63d0\u793a\u6211\u5e94\u8be5\u7528 never \uff0c\u6211\u6539\u6210 never \u540e\uff0c\u8c03\u7528\u8fd9\u4e2a\u65b9\u6cd5\u65f6\u53c8\u62a5`&lt;never&gt;\u4e0d\u80fd\u8d4b\u503c\u7ed9&lt;T&gt;`", 
      "date_published": "2024-06-25T05:55:41+00:00", 
      "title": "typescript \u5982\u4f55\u5ffd\u7565\u6cdb\u578b\u53c2\u6570\u554a\uff1f", 
      "id": "https://www.v2ex.com/t/1052423"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/ugpu", 
        "name": "ugpu", 
        "avatar": "https://cdn.v2ex.com/avatar/7d4d/0353/609132_large.png?m=1739682565"
      }, 
      "url": "https://www.v2ex.com/t/1042053", 
      "date_modified": "2024-05-19T10:42:59+00:00", 
      "content_html": "<p>\u8bf7\u95ee\u4e0b \u73b0\u5728 TypeScript \u4e3b\u8981\u7528\u6765\u505a\u540e\u7aef\u6bd4\u8f83\u591a\u8fd8\u662f\u524d\u7aef\uff1f \u540e\u7aef\u800c\u8a00\u6709\u4ec0\u4e48\u597d\u7528\u7684\u6846\u67b6. \u4e0d\u9650\u4e8e\u5404\u884c\u5404\u4e1a, \u6700\u597d\u662f\u90a3\u79cd\u4f18\u79c0 &amp; \u5f00\u6e90 &amp; \u7a33\u5b9a &amp; \u62d3\u5c55\u6027\u9ad8\u7684\u6846\u67b6.\n\u70e6\u52b3\u5927\u4f6c\u4eec\u63a8\u8350\u4e0b</p>\n", 
      "date_published": "2024-05-19T10:17:51+00:00", 
      "title": "TypeScript \u73b0\u5728\u7684\u5e94\u7528\u573a\u666f", 
      "id": "https://www.v2ex.com/t/1042053"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/FreeWong", 
        "name": "FreeWong", 
        "avatar": "https://cdn.v2ex.com/gravatar/5ed56e148231babb621f3a10f2dc478a?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1040750", 
      "date_modified": "2024-05-14T12:50:11+00:00", 
      "content_html": "<a target=\"_blank\" href=\"https://github.com/cody-greene/node-rabbitmq-client\" rel=\"nofollow noopener\">https://github.com/cody-greene/node-rabbitmq-client</a><br />\u8fd9\u4e2a\u662f\u7528 TypeScript \u5199\u7684\u4e00\u4e2a npm \u5305\uff0c\u6211\u4e0d\u4f1a TS, \u4f46\u662f\u4f1a\u7528 JavaScript \u5199 node \u5e94\u7528<br />\u8fd9\u6837\u6211\u53ef\u4ee5\u76f4\u63a5\u7528 JS \u8c03\u7528\u8fd9\u4e2a\u5305\u7684\u51fd\u6570\u5417<br />\u591a\u8c22", 
      "date_published": "2024-05-14T12:33:45+00:00", 
      "title": "==TypeScript \u5199\u7684 npm \u5305\u53ef\u4ee5\u7528 javascript \u4f7f\u7528\u5305\u7684\u51fd\u6570\u5417", 
      "id": "https://www.v2ex.com/t/1040750"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yxcoder", 
        "name": "yxcoder", 
        "avatar": "https://cdn.v2ex.com/avatar/a9ce/f61b/265242_large.png?m=1705643670"
      }, 
      "url": "https://www.v2ex.com/t/1040384", 
      "date_modified": "2024-05-13T12:06:45+00:00", 
      "content_html": "<p>react </p>\n<p>\u6211\u5728\u5b9e\u73b0\u8fd9\u4e48\u4e00\u4e2a\u6279\u91cf\u5220\u9664\u529f\u80fd</p>\n<p>\u4f46\u662f\u6279\u91cf\u5220\u9664\u4e2d\u4f1a\u6709\u67d0\u4e9b\u5185\u5bb9\u9700\u8981\u5f39\u51fa\u4e8c\u6b21\u786e\u8ba4\u5f39\u6846</p>\n<p>\u6211\u5e0c\u671b\u80fd\u591f\u901a\u8fc7 promise \u5b9e\u73b0\u94fe\u5f0f\u7684\u64cd\u4f5c</p>\n<pre><code>const delete = (ids: string[]) =&gt; {\n  ids.forEach(async(id)=&gt;{\n    await deleteOne(id)\n  })\n}\n\nconst deleteOne = async(id) =&gt; {\n  /** dosomething **/\n  if(await confirm(id)){\n    /** do delete **/\n  }\n}\n\nconst confirm = async(id){\n  /** \u8fd9\u91cc\u6211\u8981\u600e\u4e48\u5b9e\u73b0 **/\n}\n</code></pre>\n<p>\u6ce8\u610f\uff1a\u8fd9\u91cc\u7684 confirm \u9700\u8981\u5f39\u51fa\u4e8c\u6b21\u786e\u8ba4\u5f39\u6846\u5e76\u8fd4\u56de promise \uff0c\u6216\u8005\u6709\u4ec0\u4e48\u5176\u4ed6\u66f4\u597d\u7684\u529e\u6cd5\uff1f</p>\n", 
      "date_published": "2024-05-13T12:05:51+00:00", 
      "title": "react \u5982\u4f55\u4f18\u96c5\u7684\u5b9e\u73b0\u6279\u91cf\u5220\u9664+\u4e8c\u6b21\u786e\u8ba4", 
      "id": "https://www.v2ex.com/t/1040384"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/june4", 
        "name": "june4", 
        "avatar": "https://cdn.v2ex.com/avatar/4555/12c1/661756_large.png?m=1767580261"
      }, 
      "url": "https://www.v2ex.com/t/1034593", 
      "title": "TypeScript \u600e\u4e48 wrap \u4e00\u4e2a\u51fd\u6570\u5e76\u4fee\u6539\u4e00\u4e0b\u8fd4\u56de\u503c\uff1f", 
      "id": "https://www.v2ex.com/t/1034593", 
      "date_published": "2024-04-22T05:53:00+00:00", 
      "content_html": "<p>\u6bd4\u5982\u8bf4\uff0c</p>\n<pre><code class=\"language-javascript\">declare function get&lt;T&gt;(): T\ndeclare function wrap&lt;T extends () =&gt; any&gt;(fn: T):\n  (...args: Parameters&lt;T&gt;) =&gt; ReturnType&lt;T&gt; | undefined\n\n// \u8fd9\u91cc\u8fd9\u4e2a f \u7684\u7b7e\u540d\u548c\u4f20\u8fdb\u7684\u4e0d\u540c\u554a\uff0c\u6210\u4e86 () =&gt; unknown\nlet f = wrap(get)\n</code></pre>\n<p>\u9664\u975e wrap \u8fd9\u4e48\u5b9a\u4e49\uff1a</p>\n<pre><code>declare function wrap&lt;T extends () =&gt; any&gt;(fn: T): T\n</code></pre>\n<p>\u8fd9\u6837\u5012\u5b8c\u7f8e\u4e86\uff0c\u4f46\u662f\u4fee\u6539\u4e0d\u4e86\u8fd4\u56de\u503c\u4e86</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/ChrisFreeMan", 
        "name": "ChrisFreeMan", 
        "avatar": "https://cdn.v2ex.com/avatar/f6c2/fb66/539019_large.png?m=1750398514"
      }, 
      "url": "https://www.v2ex.com/t/1032888", 
      "date_modified": "2024-04-16T13:43:32+00:00", 
      "content_html": "<p>\u6211\u6709\u4e24\u4e2a\u62bd\u8c61\u7c7b\uff0c\u4f46\u662f\u5176\u7ed3\u6784\u662f\u4e00\u6837\u7684\uff0c\u4e0d\u540c\u7684\u662f\u5206\u522b\u7ee7\u627f\u4e86\u4e0d\u540c\u7684\u7c7b\uff0c\u6211\u8981\u600e\u4e48\u7b80\u5199\u8fd9\u79cd\u60c5\u51b5\u3002</p>\n<pre><code class=\"language-typescript\">export abstract class DivComponentsManager extends HTMLElement {\n  protected themeWatcher = themeWatcher\n  protected disposeFuncs: (() =&gt; void)[] = []\n\n  constructor() {\n    super()\n  }\n\n  abstract renderView(): Promise&lt;void&gt;\n\n  connectedCallback() {\n    this.renderView()\n  }\n\n  disconnectedCallback() {\n    this.disposeFuncs.forEach(func =&gt; func())\n  }\n}\n\nexport abstract class ButtonComponentsManager extends HTMLButtonElement {\n  protected themeWatcher = themeWatcher\n  protected disposeFuncs: (() =&gt; void)[] = []\n\n  constructor() {\n    super()\n  }\n\n  abstract renderView(): Promise&lt;void&gt;\n\n  connectedCallback() {\n    this.renderView()\n  }\n\n  disconnectedCallback() {\n    this.disposeFuncs.forEach(func =&gt; func())\n  }\n}\n\n</code></pre>\n", 
      "date_published": "2024-04-16T04:13:23+00:00", 
      "title": "\u60f3\u8bf7\u6559\u4e2a TypeScript \u62bd\u8c61\u7c7b\u7ee7\u627f\u7236\u7c7b\u7684\u95ee\u9898\u3002", 
      "id": "https://www.v2ex.com/t/1032888"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/treblex", 
        "name": "treblex", 
        "avatar": "https://cdn.v2ex.com/avatar/a197/3cc5/354034_large.png?m=1751458187"
      }, 
      "url": "https://www.v2ex.com/t/1022195", 
      "title": "vscode \u7eaf js \u9879\u76ee\u6709\u7c7b\u578b\u63a8\u65ad\u548c\u6210\u5458\u53d8\u91cf\u63d0\u793a\uff0c\u4f46\u662f\u5982\u679c ts \u6df7\u7528\u7684\u8bdd\uff0c js \u5bfc\u5165\u5c31\u5168\u53d8\u6210 any \u4e86\uff0c\u8bf7\u95ee\u6709\u529e\u6cd5\u89e3\u51b3\u5417", 
      "id": "https://www.v2ex.com/t/1022195", 
      "date_published": "2024-03-09T16:28:10+00:00", 
      "content_html": ""
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/tlerbao", 
        "name": "tlerbao", 
        "avatar": "https://cdn.v2ex.com/avatar/9deb/c5d9/421999_large.png?m=1745547699"
      }, 
      "url": "https://www.v2ex.com/t/1016041", 
      "date_modified": "2024-02-18T00:01:58+00:00", 
      "content_html": "<p>\u6211\u6b63\u5728\u7ea0\u7ed3\u540e\u7aef API \u7684\u7c7b\u578b\u600e\u4e48\u5b9a\u4e49\u5f52\u7c7b\u7684\u597d\uff0c\u770b\u4e86\u8fd9\u4e2a\u9879\u76ee\uff0c\u4ed6\u8bb2\u540e\u7aef\u6240\u6709\u7c7b\u578b\u5b9a\u4e49\u5728\u4e86\u4e00\u4e2a Api.d.ts \u6587\u4ef6\u4e2d,\u5730\u5740\uff1a <a href=\"https://github.com/soybeanjs/soybean-admin/blob/main/src/typings/api.d.ts\" rel=\"nofollow\">https://github.com/soybeanjs/soybean-admin/blob/main/src/typings/api.d.ts</a> \u3002</p>\n<p>\u7136\u540e\u5c31\u7c7b\u4f3c\u4e0b\u9762\u8fd9\u6837\u4f7f\u7528\u3002</p>\n<h3>\u83dc\u9e1f\u6709\u51e0\u4e2a\u95ee\u9898\uff1a</h3>\n<p>1 \u3001\u5168\u5199\u5230\u4e00\u4e2a\u6587\u4ef6\u662f\u5426\u53ef\u884c\uff0c\u5229\u5f0a\uff1f</p>\n<p>2 \u3001\u8fd9\u4e48\u5b9a\u4e49\u548c\u4f7f\u7528\u662f\u5426\u662f\u6700\u4f73\u65b9\u6848\uff0c\u6709\u548c\u5229\u5f0a\uff1f</p>\n<p>3 \u3001Typescrip \u5927\u795e\u4eec\u90fd\u662f\u600e\u4e48\u5b9a\u4e49\u548c\u4f7f\u7528\u7684\uff1f</p>\n<pre><code>export function fetchGetUserList(params?: Api.SystemManage.UserSearchParams) {\n  return request&lt;Api.SystemManage.UserList&gt;({\n    url: '/systemManage/getUserList',\n    method: 'get',\n    params\n  });\n}\n</code></pre>\n", 
      "date_published": "2024-02-17T11:26:12+00:00", 
      "title": "\u8fd9\u4e2a\u9879\u76ee\u8fd9\u6837\u5b9a\u4e49 Typescript \u7c7b\u578b\u548c\u4f7f\u7528\uff0c\u5b66\u5230\u4e86\uff0c\u6709\u51e0\u4e2a\u95ee\u9898\uff1f", 
      "id": "https://www.v2ex.com/t/1016041"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/tlerbao", 
        "name": "tlerbao", 
        "avatar": "https://cdn.v2ex.com/avatar/9deb/c5d9/421999_large.png?m=1745547699"
      }, 
      "url": "https://www.v2ex.com/t/1015681", 
      "date_modified": "2024-02-15T02:51:35+00:00", 
      "content_html": "<p>\u6709\u4e24\u4e2a\u54cd\u5e94\u7c7b\u578b ResultData \uff08\u4e0d\u5206\u9875\uff09\u548c ResultPage \uff08\u5206\u9875\uff09\uff0c\u6211\u4e0b\u9762\u5c01\u88c5\u7684 get \u65b9\u6cd5\u6bcf\u6b21\u8c03\u7528\u7684\u65f6\u5019\u90fd\u8981\u5bfc\u5165 ResultPage \u6216 ResultData \uff1b</p>\n<p>http.get&lt;ResultPage&lt;SomeType&gt;&gt;(\"/test\", params);</p>\n<p>\u6216</p>\n<p>http.get&lt;ResultData&lt;SomeType&gt;&gt;(\"/test\", params);</p>\n<h3>TS \u6709\u6ca1\u6709\u4ec0\u4e48\u529e\u6cd5\u4f20\u5165\u4e00\u4e2a\u53c2\u6570\u6216\u600e\u6837\u5b9e\u73b0\u81ea\u52a8\u8bc6\u522b\u8c03\u7528\u5206\u9875\u548c\u4e0d\u5206\u9875\u7684\u7c7b\u578b?</h3>\n<pre><code class=\"language-js\">get&lt;T&gt;(url: string, params?: object, _object = {}): Promise&lt;T&gt; {\n  return this.service.get(url, { params, ..._object });\n}\n\n// \u8bf7\u6c42\u54cd\u5e94\nexport interface Result {\n  code: string;\n  message: string;\n}\n\n// \u8bf7\u6c42\u54cd\u5e94\u6570\u636e\nexport interface ResultData&lt;T = any&gt; extends Result {\n  data: T;\n}\n\n// \u8bf7\u6c42\u5206\u9875\u54cd\u5e94\nexport interface ResultPage&lt;T&gt; extends Result {\n  count: number;\n  current: number;\n  limit: number;\n  data: T[];\n}\n</code></pre>\n", 
      "date_published": "2024-02-15T01:35:30+00:00", 
      "title": "\u8bf7\u6559\u4e00\u4e2a Typescript \u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/1015681"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/wednesdayco", 
        "name": "wednesdayco", 
        "avatar": "https://cdn.v2ex.com/gravatar/7c87cf97143eb538183d6445f9147d0a?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1012854", 
      "date_modified": "2024-02-01T02:12:53+00:00", 
      "content_html": "\u9700\u6c42\uff1a \u4e00\u4e2a\u7c7b\u578b\u5fc5\u987b\u5305\u542b id \u5c5e\u6027\uff0c\u503c\u7684\u7c7b\u578b\u4e3a string \uff0c\u540c\u65f6\u5b83\u53ef\u80fd\u5305\u542b\u5176\u4ed6\u7684\u5c5e\u6027\uff0c\u4f46\u503c\u7684\u7c7b\u578b\u5fc5\u987b\u662f number \u3002", 
      "date_published": "2024-01-30T09:50:45+00:00", 
      "title": "\u8fd9\u79cd\u7684\u7c7b\u578b\u662f\u4e0d\u662f\u5b9e\u73b0\u4e0d\u4e86(TypeScript)", 
      "id": "https://www.v2ex.com/t/1012854"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yangblink", 
        "name": "yangblink", 
        "avatar": "https://cdn.v2ex.com/avatar/8933/6e14/173136_large.png?m=1477357742"
      }, 
      "url": "https://www.v2ex.com/t/1011590", 
      "date_modified": "2024-01-25T12:46:16+00:00", 
      "content_html": "\u8be6\u7ec6\u95ee\u9898\u89c1:<br /><a target=\"_blank\" href=\"https://segmentfault.com/q/1010000044590133\" rel=\"nofollow noopener\">https://segmentfault.com/q/1010000044590133</a>", 
      "date_published": "2024-01-25T12:45:09+00:00", 
      "title": "\u95ee\u9898\u4e00\u4e2a typescript \u7c7b\u578b\u5305\u88f9\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/1011590"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/zxkmm", 
        "name": "zxkmm", 
        "avatar": "https://cdn.v2ex.com/gravatar/7d339b00f7a2ee868d6281f5e226db6e?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1011000", 
      "title": "\u9047\u5230\u4e86\u6781\u5176\u8be1\u5f02\u7684\u4e0d\u7b26\u5408\u8fdb\u5165 if \u6761\u4ef6\u7684\u8981\u6c42\u4f46\u662f\u8fd8\u662f\u8fdb\u5165\u4e86", 
      "id": "https://www.v2ex.com/t/1011000", 
      "date_published": "2024-01-23T13:11:30+00:00", 
      "content_html": "<p>\u4ee3\u7801</p>\n<pre><code>    addFrontLine(_line_location_, _padding_, _border_) {\n\n        console.log(_padding_);\n        console.log(_line_location_);\n\n        if (_padding_ &gt;= _line_location_) {\n\n            _padding_ = _line_location_\n\n        }\n\n        console.log(_padding_);\n        console.log(_line_location_);\n\n        const css = `\n\n        .layout-tab-container .b3-list-item &gt; .b3-list-item__toggle {\n            padding-left: 4px !important;\n        }\n\n        .layout-tab-container ul ul:before {\n            content: \"\";\n            position: absolute;\n            top: 0;\n            bottom: 0;\n            left: ${_line_location_}px;\n            border-left: ${_border_}px solid var(--b3-theme-background-light);\n        }\n        \n        .layout-tab-container ul ul {\n            position: relative;\n            padding-left: ${_padding_}px;\n        }\n        \n        `\n        this.applyStyles(css);\n    }\n</code></pre>\n<p>\u6267\u884c\u540e\u63a7\u5236\u53f0\u8f93\u51fa\u7684\u503c</p>\n<pre><code>6\n20\n20\n20\n</code></pre>\n<p>\u5982\u679c\u628a if \u8bed\u53e5\u6ce8\u91ca\u6389\uff0c\u5c31\u6062\u590d\u6b63\u5e38\u4e86\u3002\n\u6709\u6ca1\u6709\u5927\u4f6c\u5e2e\u770b\u770b\u662f\u4ec0\u4e48\u539f\u56e0\uff1f\n\u5b8c\u6574\u4ee3\u7801\n<a href=\"https://github.com/zxkmm/siyuan_doctree_compress/blob/13f1b3cda6c721001c1c33ab449e6321bc791807/src/index.ts#L118\" rel=\"nofollow\">https://github.com/zxkmm/siyuan_doctree_compress/blob/13f1b3cda6c721001c1c33ab449e6321bc791807/src/index.ts#L118</a></p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yxcoder", 
        "name": "yxcoder", 
        "avatar": "https://cdn.v2ex.com/avatar/a9ce/f61b/265242_large.png?m=1705643670"
      }, 
      "url": "https://www.v2ex.com/t/1009990", 
      "title": "typescript \u7684\u7c7b\u578b\u5904\u7406", 
      "id": "https://www.v2ex.com/t/1009990", 
      "date_published": "2024-01-19T05:59:42+00:00", 
      "content_html": "<p>1 \u3001interface</p>\n<pre><code>interface TypeD{\n    subTypeA: string;\n    subTypeB: number;\n}\ninterface TypeProp{\n    typeA: string;\n    typeB: number;\n    typeC: boolean;\n    typeD: TypeD;\n}\n</code></pre>\n<p>2 \u3001data</p>\n<pre><code>const data1: TypeProp = {\n    typeA: 'yes',\n    typeB: 1,\n    typeC: true,\n    typeD: {\n    \tsubTypeA: 'no',\n        subTypeB: 0,\n    }\n}\n</code></pre>\n<p>3 \u3001function</p>\n<pre><code>const dosomething = (data: keyof TypeProp):[?] =&gt; {\n\treturn data1[data]\n}\n</code></pre>\n<p>\u8bf7\u95ee [?] \u5904\u6211\u9700\u8981\u600e\u4e48\u5904\u7406(\u6216\u8005\u6211\u9700\u8981\u5982\u4f55\u5b9a\u4e49 dosomething)\uff0c\u624d\u80fd\u8868\u793a\u8fd4\u56de\u7684\u662f data1[data]\u7684\u7c7b\u578b</p>\n<p>\u6211\u60f3\u8981\u7684</p>\n<pre><code>const b = dosomething('typeB') // b \u662f number \u7c7b\u578b\nconst c = dosomething('typeC') // c \u662f boolean \u7c7b\u578b\nconst d = dosomething('typeD') // d \u662f TypeD \u7c7b\u578b\n</code></pre>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/dcsuibian", 
        "name": "dcsuibian", 
        "avatar": "https://cdn.v2ex.com/gravatar/c29cba0b0706786011c11a5db6cb8b97?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1004887", 
      "title": "\u60f3\u95ee\u95ee\u5927\u5bb6 TypeScript \u4e2d\u5173\u4e8e null \u5904\u7406\u7684\u65b9\u5f0f", 
      "id": "https://www.v2ex.com/t/1004887", 
      "date_published": "2023-12-31T21:00:38+00:00", 
      "content_html": "<p>\u7b2c\u4e00\u79cd\uff1a\u5f00\u542f<code>strictNullChecks</code>\u3002</p>\n<pre><code class=\"language-typescript\">interface C {\n  foo: string;\n}\ninterface B {\n  c: C | null;\n}\ninterface A {\n  b: B | null;\n}\n\ndeclare const a: A;\n\nconsole.log(a.b!.c!.foo)\n</code></pre>\n<p>\u7b2c\u4e8c\u79cd\uff1a\u5173\u95ed<code>strictNullChecks</code>\u3002</p>\n<pre><code class=\"language-typescript\">interface C {\n  foo: string;\n}\ninterface B {\n  c: C;\n}\ninterface A {\n  b: B;\n}\n\nconst a: A = {\n  b: null,\n};\n</code></pre>\n<p>\u5927\u5bb6\u66f4\u503e\u5411\u4e8e\u54ea\u4e00\u79cd\u5462\uff1f</p>\n<p>\u6211\u4e2a\u4eba\u73b0\u5728\u7528\u7684\u7b2c\u4e00\u79cd\uff0c\u4f46\u603b\u611f\u89c9\u5f88\u9ebb\u70e6\u3002\u7c7b\u578b\u58f0\u660e\u65f6\u8981\u52a0\u4e2a null \u5012\u8fd8\u597d\uff0c\u4e3b\u8981\u662f\u6bcf\u5904\u8c03\u7528\u90fd\u8981\u52a0\u4e2a<code>!.</code>\u6216<code>?.</code>\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/rizon", 
        "name": "rizon", 
        "avatar": "https://cdn.v2ex.com/avatar/8b75/b98f/305534_large.png?m=1775024376"
      }, 
      "url": "https://www.v2ex.com/t/994647", 
      "date_modified": "2023-11-24T01:12:06+00:00", 
      "content_html": "<p>\u6211\u5728\u5b66\u4e60 react \uff0c\u770b\u5230\u7ed9\u4e00\u4e2a div \u6dfb\u52a0 onMouseDown \u4e8b\u4ef6\u65f6\uff0c<br/>\n\u8fd9\u4e2a\u4e8b\u4ef6\u672c\u8eab\u7684\u58f0\u660e\u662f\uff1a<code>onMouseDown?: MouseEventHandler&lt;T&gt; | undefined;</code>\n\u5199\u5b83\u7684\u5b9e\u73b0\u7c7b\u65f6\u4e3a</p>\n<pre><code class=\"language-typescript\">  const handleMouseDown = (event:React.MouseEvent&lt;HTMLDivElement,MouseEvent&gt;) =&gt; {\n\n  }\n</code></pre>\n<p>event \u7684\u7c7b\u578b\u4e3a MouseEvent \uff0c\u8fd9\u4e2a\u662f\u53ef\u4ee5\u770b\u4ee3\u7801\u770b\u51fa\u6765\u7684\uff0c\u4f46\u662f\u91cc\u9762\u7684\u6cdb\u578b<code>HTMLDivElement</code>\uff0c\u6211\u8fd9\u4e0a\u54ea\u731c\u53bb\uff0c\uff0c\uff0c  </p>\n<ol>\n<li>\u867d\u7136\u4e0d\u5199\u8fd9\u4e48\u4e25\u683c\u4e5f\u6ca1\u95ee\u9898\uff0c\u4f46\u662f\u6211\u7684\u95ee\u9898\u662f\u57fa\u4e8e\u60f3\u8981\u6700\u5b8c\u6574\u4e25\u683c\u7684\u4f7f\u7528 type \u7684\u524d\u63d0\u3002</li>\n<li>\u8fd9\u53ea\u662f\u4e3e\u4e2a\u4f8b\u5b50\u8bf4\u660e\u6211\u7684\u95ee\u9898\uff0c\u6211\u6838\u5fc3\u95ee\u9898\u662f\uff0ctypescript \u4e2d\uff0c\u7f16\u8f91\u5668\u4f9d\u7136\u4e0d\u80fd\u81ea\u52a8\u63a8\u6d4b\u51fa\u6240\u6709\u7684\u5b57\u6bb5\u7c7b\u578b\uff0c\u5bf9\u4e8e\u7f16\u8f91\u5668\u65e0\u6cd5\u63a8\u6d4b\u7684\u60c5\u51b5\u4e0b\uff0c\u6211\u8be5\u5982\u4f55\u53bb\u66f4\u597d\u7684\u9762\u5bf9\u548c\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u5462\u3002</li>\n<li>\u524d\u7aef\u6837\u5f0f\u6709\u4ec0\u4e48\u597d\u7684\u89c4\u8303\u6587\u6863\u5417\uff0c\u6211\u662f\u81ea\u5b66\u7684\uff0c\u867d\u7136\u80fd\u5199\u51fa\u6837\u5f0f\u6765\uff0c\u4f46\u662f\u4ee3\u7801\u7684\u5065\u58ee\u6027\u3001\u4f18\u96c5\u7b49\u5404\u65b9\u9762\u5dee\u592a\u591a\u4e86\uff0c\u6709\u4ec0\u4e48\u66f4\u7cfb\u7edf\u7684\u5b66\u4e60\u6750\u6599\u5417</li>\n</ol>\n", 
      "date_published": "2023-11-23T12:55:29+00:00", 
      "title": "\u6709\u6ca1\u6709\u58f0\u660e typescript \u7c7b\u578b\u7684\u597d\u529e\u6cd5\u4ee5\u53ca\u524d\u7aef\u6837\u5f0f\u7684\u5065\u58ee\u6027\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/994647"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yxcoder", 
        "name": "yxcoder", 
        "avatar": "https://cdn.v2ex.com/avatar/a9ce/f61b/265242_large.png?m=1705643670"
      }, 
      "url": "https://www.v2ex.com/t/989035", 
      "date_modified": "2023-11-06T03:48:50+00:00", 
      "content_html": "<p>type TYPE1 {...}</p>\n<p>type TYPE2 {...}</p>\n<p>type TYPE3 {...}</p>\n<p>type TYPE4 {...}</p>\n<p>type ALL = TYPE1 | TYPE2 | TYPE3 | TYPE4</p>\n<p>\u95ee\uff1a\ntask \u662f TYPE1 | TYPE2 | TYPE3 \u7c7b\u578b\u5e94\u8be5\u600e\u4e48\u8868\u793a\uff1f\uff08\u6392\u9664 TYPE2 \uff09\uff0c\u8fd9\u91cc ALL \u53ef\u80fd\u6709\u5f88\u591a\u79cd\u7c7b\u578b\uff0c\u6240\u4ee5\u4e0d\u60f3\u91cd\u65b0\u5199\u4e00\u904d</p>\n", 
      "date_published": "2023-11-06T03:45:33+00:00", 
      "title": "typescript \u7c7b\u578b\u65ad\u8a00\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/989035"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/justin2018", 
        "name": "justin2018", 
        "avatar": "https://cdn.v2ex.com/avatar/83e8/4827/351542_large.png?m=1678627464"
      }, 
      "url": "https://www.v2ex.com/t/988545", 
      "date_modified": "2023-11-06T23:40:44+00:00", 
      "content_html": "<p>\u6765\u6e90\uff1a</p>\n<p><a href=\"https://www.zhenghao.io/posts\" rel=\"nofollow\">https://www.zhenghao.io/posts</a></p>\n<hr/>\n<p>An introduction to type programming in TypeScript </p>\n<p><a href=\"https://www.zhenghao.io/posts/type-programming\" rel=\"nofollow\">https://www.zhenghao.io/posts/type-programming</a> </p>\n<hr/>\n<p>The type hierarchy tree </p>\n<p><a href=\"https://www.zhenghao.io/posts/type-hierarchy-tree#the-top-of-the-tree\" rel=\"nofollow\">https://www.zhenghao.io/posts/type-hierarchy-tree#the-top-of-the-tree</a></p>\n", 
      "date_published": "2023-11-04T03:38:50+00:00", 
      "title": "TypeScript \u4e2d\u7c7b\u578b\u7f16\u7a0b\u7b80\u4ecb", 
      "id": "https://www.v2ex.com/t/988545"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/lqzhgood", 
        "name": "lqzhgood", 
        "avatar": "https://cdn.v2ex.com/avatar/60d1/42cf/82004_large.png?m=1697680879"
      }, 
      "url": "https://www.v2ex.com/t/981666", 
      "date_modified": "2023-10-13T05:09:13+00:00", 
      "content_html": "<h3>\u95ee\u9898</h3>\n<pre><code class=\"language-ts\">enum Type {\n    Title = 'Title',\n    Input = 'Input',\n}\n\ntype InputConfType = number;\ntype TitleConfType = string\n\n// map 1 \u5bf9 1\ntype ConfList = {\n    [Type.Input]: InputConfType,\n    [Type.Title]: TitleConfType,\n};\n\n\n// \u60f3\u751f\u6210\u4e00\u4e2a\u63a5\u53e3 A, \u786e\u4fdd type \u548c conf \u83b7\u5f97\u5bf9\u5e94\u7c7b\u578b, \u9002\u7528\u4e8e\u4ee5\u4e0b\u60c5\u51b5\n\nconst Input : A ={\n    type: Type.Input,\n    conf: 11\n}\n\nconst Title : A ={\n    type: Type.Title,\n    conf: 'str'\n}\n\n// \u5982\u679c\u51fa\u73b0\u6709\u4ee5\u4e0b\u60c5\u51b5\u5219\u62a5\u9519\n\nconst ErrorTemplate : A ={\n    type: Type.Input,\n    conf: 'str\n}\n\n\n</code></pre>\n<p>\u60f3\u8c61\u4e2d\u7684 A \u63a5\u53e3 \u6548\u679c \u7c7b\u4f3c\u4e8e, \u6c42\u89e3....</p>\n<pre><code class=\"language-ts\">interface A &lt; T=ConfList, K=keyof T &gt; {\n    type: K;\n    conf: T[K]\n}\n</code></pre>\n<h3>\u5410\u69fd</h3>\n<p>Ts \u60f3\u5199\u5b8c\u7f8e, \u7279\u522b\u662f\u6d89\u53ca \u7ea6\u675f \u771f\u50cf\u662f\u6234\u7740\u9563\u94d0\u8df3\u821e....<br/>\n<code>as</code> \u4e00\u628a\u68ad\u53c8\u611f\u89c9\u4e0d\u592a\u4f18\u96c5~~~\n\ud83d\udc36</p>\n", 
      "date_published": "2023-10-13T05:05:44+00:00", 
      "title": "[\u6c42\u52a9] \u7c7b\u578b { K:V } --> { \"type\": K , \"conf\": V } \u4e14\u7ea6\u675f", 
      "id": "https://www.v2ex.com/t/981666"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/buxiugangpen", 
        "name": "buxiugangpen", 
        "avatar": "https://cdn.v2ex.com/gravatar/0643d45fbcc32cf70e7e37eccb44642f?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/980125", 
      "date_modified": "2023-10-09T02:23:40+00:00", 
      "content_html": "<p>\u5927\u4f6c\u4eec\uff0cvscode \u5f00\u53d1 ts \uff0c\u8fd9\u4e2a\u5730\u65b9\u7684\u63d0\u793a\uff0c\u600e\u4e48\u4fee\u6539\u6210\u4e2d\u6587\u554a\uff0c\u5982\u4e0b\u56fe\uff0c\u82f1\u6587\u4e0d\u597d\uff0c\u597d\u591a\u5730\u65b9\u5730\u65b9\u770b\u4e0d\u592a\u61c2\n\u6ca1\u6cd5\u53d1\u56fe\u7247\uff01\uff01\uff01\uff01\n\u5c31\u662f\u628a\u9f20\u6807\u653e\u5230\u65b9\u6cd5\u4e0a\u9762\uff0c\u770b\u65b9\u6cd5\u7684\u4ecb\u7ecd\uff0c\u8fd9\u79cd\uff0c\n\u6bd4\u5982\uff0c\u4e00\u4e2a\u6570\u7ec4 array1\narray1.pop(),,,,\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u628a\u9f20\u6807\u653e\u5230 pop \u4e0a\uff0c\u6216\u8005\u5199 pop \u7684\u65f6\u5019\u4f1a\u663e\u793a\u4e0b\u9762\u7684\u7b80\u4ecb\nRemoves the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.\n\u8fd9\u4e2a\u7b80\u4ecb\u662f\u82f1\u6587\u7684\uff0c\u600e\u4e48\u4fee\u6539\u6210\u4e2d\u6587\n\u6709\u6ca1\u6709\u5927\u4f6c\u77e5\u9053\u6492</p>\n", 
      "date_published": "2023-10-09T02:20:48+00:00", 
      "title": "\u5927\u4f6c\u4eec\uff0c vscode \u5f00\u53d1 ts\uff0c\u8fd9\u4e2a\u5730\u65b9\u7684\u63d0\u793a\uff0c\u600e\u4e48\u4fee\u6539\u6210\u4e2d\u6587\u554a", 
      "id": "https://www.v2ex.com/t/980125"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/wdssmq", 
        "name": "wdssmq", 
        "avatar": "https://cdn.v2ex.com/avatar/6632/34db/85366_large.png?m=1638374341"
      }, 
      "url": "https://www.v2ex.com/t/979738", 
      "title": "TypeScript \u4e2d\u300c\u7c7b\u578b\u5b9a\u4e49\u7684\u547d\u540d\u7a7a\u95f4\u300d\u4f7f\u7528", 
      "id": "https://www.v2ex.com/t/979738", 
      "date_published": "2023-10-08T02:20:58+00:00", 
      "content_html": "<p>@<a href=\"/member/types\">types</a>/dplayer - npm</p>\n<p>https://www.npmjs.com/package/@types/dplayer?activeTab=code</p>\n<pre><code class=\"language-ts\">// d.ts\nexport as namespace DPlayer;\n\nexport default class DPlayer {\n\n}\n\n// \u5bfc\u5165\u59ff\u52bf 1\nimport DPlayer from 'dplayer'\n\n// \u5bfc\u5165\u59ff\u52bf 2\nimport DPlayerX from 'dplayer'\n// import type DPlayer from 'dplayer'\n\n</code></pre>\n<p>\u59ff\u52bf 1 \u597d\u50cf\u662f\u53ef\u4ee5\u4f7f\u7528\u7684\uff0c\u4f46\u662f\u611f\u89c9\u6709\u4e9b\u4e0d\u597d\u533a\u5206\uff08\u56fe 1 \u30012 \uff09\uff1b</p>\n<p><strong>\u56fe 3 \u662f\u80fd\u627e\u5230\u547d\u540d\u7a7a\u95f4\uff0c\u4f46\u662f\u4ecd\u7136\u63d0\u793a\u672a\u5b9a\u4e49\uff0c\u5c31\u611f\u89c9\u548c\u7406\u89e3\u4e0d\u592a\u4e00\u6837\uff0c\u867d\u7136\u53ef\u4ee5\u4f7f\u7528 <code>/* global DPlayer */</code> \u5c4f\u853d\u63d0\u793a\uff1b</strong></p>\n<p>\u6240\u4ee5\u76ee\u524d\u63a2\u7d22\u51fa\u6765\u7684\u7ed3\u8bba\uff1a</p>\n<ul>\n<li><code>import XXX from</code> \u53ef\u4ee5\u4f5c\u4e3a\u300c\u503c\u300d\u4f7f\u7528\uff0c\u5b58\u5728\u7c7b\u578b\u5b9a\u4e49\u65f6\u53ef\u4ee5\u7528\u4f5c\u300c\u7c7b\u578b\u300d\uff0c\u4f5c\u4e3a\u300c\u503c\u300d\u6216\u300c\u7c7b\u578b\u300d\u5747\u4e0d\u9700\u8981\u548c\u5bfc\u51fa\u540d\u76f8\u540c\uff1b</li>\n<li><code>import type XXX from</code> \u4e0d\u80fd\u4f5c\u4e3a\u300c\u503c\u300d\u4f7f\u7528\uff0c\u7528\u4f5c\u300c\u7c7b\u578b\u300d\u65f6\u4e0d\u9700\u8981\u548c\u5bfc\u51fa\u540d\u76f8\u540c\uff1b</li>\n<li>\n\u5bf9\u4e8e\u300c\u547d\u540d\u7a7a\u95f4\u300d\uff0c\u6211\u8fd9\u513f\u662f\u7528\u4e09\u659c\u7ebf\u6307\u5b9a\u5bfc\u5165\u4e86 <code>@types/dplayer</code>\uff0c\u4f46\u662f\u53bb\u6389\u597d\u50cf\u8fd8\u662f\u80fd\u627e\u5230\uff0c\u597d\u50cf\u4e5f\u6ca1\u5176\u4ed6\u4e13\u95e8\u7684\u5bfc\u5165\u8bed\u6cd5\uff1f<ul>\n<li>\u4e0a\u8fb9\u4e24\u79cd <code>import</code> \u5bfc\u5165\u5747\u53ef\u4ee5\u4e0e\u300c\u547d\u540d\u7a7a\u95f4\u300d\u540c\u540d\uff0c\u6b64\u65f6\u53ef\u4ee5\u6309\u4f7f\u7528\u65b9\u5f0f\u8bc6\u522b\u4e3a\u300c\u547d\u540d\u7a7a\u95f4\u300d\uff0c\u540c\u65f6\u6d88\u9664 eslint \u7684 <code>no-undef</code> \u63d0\u793a\uff1b</li>\n</ul>\n</li>\n</ul>\n<p>\u611f\u89c9\u5c31\u662f ts \u548c eslint \u6ca1\u80fd\u914d\u5408\u597d\uff0c\uff0c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u8fb9\u65b9\u5f0f\u4e4b\u4e00\u6765\u5e94\u5bf9\uff1a</p>\n<ol>\n<li>\u4f7f\u7528\u4e0e\u300c\u547d\u540d\u7a7a\u95f4\u300d\u540c\u540d\u7684 <code>import</code> \u5bfc\u5165\uff0c\u7406\u89e3\u4e4b\u540e\u597d\u50cf\u4e5f\u8fd8\u884c\uff1b</li>\n<li>\u4e3a\u300c\u547d\u540d\u7a7a\u95f4\u300d\u6307\u5b9a <code>/* global XXX */</code> \u4ee5\u5c4f\u853d eslint \u63d0\u793a\uff1b</li>\n<li>\u4e0d\u4f7f\u7528\u300c\u547d\u540d\u7a7a\u95f4\u300d\uff0c\u76f4\u63a5\u4f7f\u7528 <code>import</code> \u5bfc\u5165\u5176\u4e0b\u7684\u5177\u4f53\u7c7b\u578b\uff1b</li>\n</ol>\n<p><img alt=\"001.png\" class=\"embedded_image\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"https://s2.loli.net/2023/10/08/X3VZdkK9rWs8Lul.png\"/></p>\n<p>\u2191 \u56fe 1</p>\n<p><img alt=\"002.png\" class=\"embedded_image\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"https://s2.loli.net/2023/10/08/X1Bs53KWtPJIjhp.png\"/></p>\n<p>\u2191 \u56fe 2</p>\n<p><img alt=\"003.png\" class=\"embedded_image\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"https://s2.loli.net/2023/10/08/dYCiA5XhSwFKn8N.png\"/></p>\n<p>\u2191 \u56fe 3</p>\n<blockquote>\n<p>\u300c\u7b14\u8bb0\u300d\u5404\u79cd\u788e\u7247\u4fe1\u606f\u300c 2023-10-07 \u300d_\u7535\u8111\u7f51\u7edc_\u6c89\u51b0\u6d6e\u6c34</p>\n<p><a href=\"https://www.wdssmq.com/post/20230223818.html\" rel=\"nofollow\" title=\"\u300c\u7b14\u8bb0\u300d\u5404\u79cd\u788e\u7247\u4fe1\u606f\u300c 2023-10-07 \u300d_\u7535\u8111\u7f51\u7edc_\u6c89\u51b0\u6d6e\u6c34\">https://www.wdssmq.com/post/20230223818.html</a></p>\n</blockquote>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/chenliangngng", 
        "name": "chenliangngng", 
        "avatar": "https://cdn.v2ex.com/gravatar/780a5460ba7bbd960d7046fa4ad1e463?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/975943", 
      "date_modified": "2023-09-21T11:02:02+00:00", 
      "content_html": "<p>\u516c\u53f8\u8001\u9879\u76ee\uff0c\u6539 tsconfig \u7684 strick \u65e0\u6548\uff0c\u53ef\u80fd\u662f\u5f15\u5165\u7684\u5176\u4ed6\u9879\u76ee\u7684\u4f9d\u8d56\u5bfc\u81f4\u8986\u76d6\u4e86\u914d\u7f6e\uff0c\u5bfc\u81f4\u9879\u76ee\u62a5 ts \u9519\u8bef\u65e0\u6cd5\u8fdb\u884c\u5f00\u53d1</p>\n<p>\u8bf7\u95ee\u6709\u4ec0\u4e48\u529e\u6cd5\u53ef\u4ee5\u628a ts \u7684\u68c0\u9a8c\u62a5\u9519\u6539\u6210 warning \u5417</p>\n<p>\u6211\u627e\u4e86\u51e0\u4e2a\u95ee\u7b54\u4e0d\u662f\u6211\u6240\u9700\u8981\u7684\uff0c\u56e0\u4e3a\u6211\u8fd9\u8fb9\u6ca1\u6709 tslint \u3002ts \u7248\u672c\u662f 4.1.5</p>\n<p><a href=\"https://github.com/wmonk/create-react-app-typescript/issues/238\" rel=\"nofollow\">https://github.com/wmonk/create-react-app-typescript/issues/238</a></p>\n<p><a href=\"https://stackoverflow.com/questions/51594478/make-complieroptions-generate-warnings-instead-of-errors-in-tsconfig\" rel=\"nofollow\">https://stackoverflow.com/questions/51594478/make-complieroptions-generate-warnings-instead-of-errors-in-tsconfig</a></p>\n<p>\u5982\u679c\u6ca1\u6cd5\u89e3\u51b3\uff0c\u6211\u53ef\u80fd\u53ea\u80fd\u5728\u6240\u6709\u7684\u6587\u4ef6\u4e0a\u52a0<code>// ts-nocheck</code>\u6765\u89c4\u907f\u95ee\u9898</p>\n", 
      "date_published": "2023-09-21T09:22:39+00:00", 
      "title": "\u6709\u6ca1\u6709\u529e\u6cd5\u628a ts \u7684 error \u62a5\u9519\u6539\u6210 warning", 
      "id": "https://www.v2ex.com/t/975943"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/lqzhgood", 
        "name": "lqzhgood", 
        "avatar": "https://cdn.v2ex.com/avatar/60d1/42cf/82004_large.png?m=1697680879"
      }, 
      "url": "https://www.v2ex.com/t/971304", 
      "date_modified": "2023-09-06T02:03:16+00:00", 
      "content_html": "<p>\u6211\u6709\u4e00\u4e2a Map \uff0c\u4e00\u4e00\u5bf9\u5e94\u3002</p>\n<p><code>TAP_TYPE.LOCAL</code> \u5bf9\u5e94 <code>TAP_LOCAL</code>,</p>\n<p><code>TAP_TYPE.MAP</code> \u5bf9\u5e94 <code>TAP_MAP</code>\u3002</p>\n<p>\u6211\u5728\u51fd\u6570\u4e2d\u5df2\u7ecf\u901a\u8fc7 switch \u7ea6\u675f test \u7684 v, \u4e3a\u4ec0\u4e48 ts \u8fd8\u662f\u63a8\u5bfc v \u7684\u7c7b\u578b\u662f <code>TAP_LOCAL | TAP_MAP</code> \uff1f</p>\n<p>\u6216\u8005\u5bf9\u8fd9\u6837\u7684\u4f8b\u5b50\uff0c\u9664\u4e86\u5bf9 v \u8fdb\u884c\u5f3a\u5236\u65ad\u8a00\uff0c\u6709\u4ec0\u4e48\u66f4\u597d\u7684\u5199\u6cd5\u5417\uff1f</p>\n<pre><code class=\"language-ts\">enum TAP_TYPE {\n    'LOCAL',\n    'MAP',\n}\n\ninterface TAP_LOCAL {\n    a: string;\n}\n\ninterface TAP_MAP {\n    b: string;\n}\n\ntype TapTypeMap = {\n    [TAP_TYPE.LOCAL]: TAP_LOCAL;\n    [TAP_TYPE.MAP]: TAP_MAP;\n};\n\nfunction test&lt;T extends TAP_TYPE&gt;(t: T, v: TapTypeMap[T]) {\n    switch (t) {\n        case TAP_TYPE.LOCAL:\n            return v.a;  // \u7c7b\u578b\u9519\u8bef  \u7c7b\u578b\u201cTAP_LOCAL | TAP_MAP\u201d\u4e0a\u4e0d\u5b58\u5728\u5c5e\u6027\u201ca\u201d\u3002\n        case TAP_TYPE.MAP:\n            return v.b;  // \u7c7b\u578b\u9519\u8bef  \u7c7b\u578b\u201cTAP_LOCAL | TAP_MAP\u201d\u4e0a\u4e0d\u5b58\u5728\u5c5e\u6027\u201cb\u201d\u3002\n    }\n}\n</code></pre>\n", 
      "date_published": "2023-09-06T02:02:53+00:00", 
      "title": "[\u6c42\u52a9] \u51fd\u6570\u4e2d\u4f7f\u7528\u6cdb\u578b\u7f29\u5c0f\u53c2\u6570\u7c7b\u578b", 
      "id": "https://www.v2ex.com/t/971304"
    }
  ]
}