Kong / Kong/httpsnippet

Typescript error when `postData` is missing

Abierto
#325 3 comentarios 3 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
1.2k
Forks
242
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
developer-experience
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.