TS2724
error TS2724: ‘./index
‘ has no exported member named ‘HeaderOptions
‘. Did you mean ‘HeaderOption
‘?
Broken Code ❌
index.ts1 2 3 4
| export interface HeaderOption { Authorization: string; 'Cache-Control': string; }
|
printHeader.ts1 2 3 4 5
| import {HeaderOptions} from './index';
export function printHeader(header: HeaderOptions) { console.log(header); }
|
Fixed Code ✔️
TypeScript noticed a typing error in the name of the imported interface. The code will work if we correct the typo:
printHeader.ts1 2 3 4 5
| import {HeaderOption} from './index';
export function printHeader(header: HeaderOption) { console.log(header); }
|