E0213: TypeScript's 'interface' feature is not allowed in JavaScript code
JavaScript does not support interfaces. It is a syntax error to write a TypeScript interface in JavaScript code:
interface Response<T> {
ok: boolean;
error?: string;
data?: T;
}
To fix this error, rename your file to have a .ts
or .tsx
suffix.
Alternatively, use JSDoc to declare the interface:
/**
* @typedef {Object} Response - creates a new type named 'SpecialType'
* @prop {boolean} ok
* @prop {string} [error] - a number property of SpecialType
* @prop {Object} data
*/