В одной из библиотек, которые я использую, отсутствуют некоторые типы.
Я пытаюсь расширить его пространство имен и вручную добавить типы, но не могу понять, как это сделать
I есть index.d.ts
root моего проекта
/// <reference path="./node_modules/@react-native-mapbox-gl/maps/index.d.ts" />
export {}; // this file needs to be a module
declare global {
export interface LatLng {
latitude: number;
longitude: number;
}
}
declare namespace MapboxGL {
export class MarkerView {
}
}
и внутри моего компонента
<MapboxGL.MarkerView />
, но у меня все еще есть ошибка Property MarkerView does not exist
Здесь это tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"lib": ["es6"],
"allowJs": true,
"jsx": "react-native",
"noEmit": true,
"isolatedModules": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"baseUrl": "./",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"exclude": [
"node_modules", "babel.config.js", "metro.config.js", "jest.config.js"
]
}