Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Typescript error when `postData` is missing

未關閉
#325 3 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
typescript

研究方向

從錯誤中參照的 TypeScript 宣告 httpsnippet.d.ts 開始,將其 HarRequest 定義與不帶 postData 建構 HTTPSnippet 的範例進行比較。透過編譯所示範例並確認缺少 postData 的錯誤已消失,驗證修正後的型別定義。

由索引模型根據 Issue 內容生成。

描述

From the example:

const snippet = new HTTPSnippet({
        method: 'GET',
        url: 'http://mockbin.com/request',
      });

      const options = { indent: '\t' };
      const output = snippet.convert('shell', 'curl', options);
      console.log(output);

I get a typescript error

Argument of type '{ method: string; url: string; }' is not assignable to parameter of type 'HarRequest | HarEntry'.
  Type '{ method: string; url: string; }' is not assignable to type 'HarRequest'.
    Property 'postData' is missing in type '{ method: string; url: string; }' but required in type '{ postData: any; }'.ts(2345)
httpsnippet.d.ts(19, 5): 'postData' is declared here.
主要語言
TypeScript
星號
1.2k
分支
241
PR 合併指標
30 天內沒有已合併 PR

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

Kong/httpsnippet 的其他 Issue

查看 Kong/httpsnippet 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。