This NextJS 13 project utilizes a package that has an inner core dependency (react-leaflet->@react-leaflet/core).
When running yarn run build
, the build fails at "Linting and checking validity of types."
It appears to be a TypeScript compatibility issue related to import {type MyType}
.
Link to specific file in the dependency
https://i.sstatic.net/CE6A7.png
package.json:
{
"dependencies": {
"next": "^13.0.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-leaflet": "^4.2.0",
"leaflet": "^1.9.3"
},
"devDependencies": {
"@types/leaflet": "^1.9.0",
"@types/node": "18.11.17",
"@types/react": "17.0.20",
"eslint": "7.32.0",
"eslint-config-next": "^13.0.7",
"typescript": "4.4.2"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
After expecting yarn run build
to compile successfully, the issue was resolved by using yarn upgrade --latest
to update the typescript
version.