Typescript error when `postData` is missing
- 主要語言
- TypeScript
- 星號
- 1.2k
- 分支
- 242
- PR 合併指標
- 30 天內沒有已合併 PR
描述
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.
```
貢獻指南
研究方向
Start with the TypeScript declaration referenced in the error, httpsnippet.d.ts, and compare its HarRequest definition with the example that constructs HTTPSnippet without postData. Verify the corrected typing by compiling the shown example and confirming that the missing-postData error is gone.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- typescript
- 領域
- developer-experience
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 48/100