Create custom type definitions for JavaScript dependencies
tsconfig.paths.json β Example
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@assets": ["./assets/index"],
"@assets/*": ["./assets/*"],
"@contexts": ["./contexts/index"],
"@contexts/*": ["./contexts/*"],
"@components": ["./components/index"],
"@components/*": ["./components/*"],
"@hooks": ["./hooks/index"],
"@hooks/*": ["./hooks/*"],
"@libs/*": ["./libs/*"],
"@modules/*": ["./modules/*"],
"@services/api": ["./services/api/index"],
"@services/api/*": ["./services/api/*"],
"@services/*": ["./services/*"],
"@shared/*": ["./shared/*"],
"@store": ["./store/index"],
"@store/*": ["./store/*"],
"@styles": ["./styles/index"],
"@styles/*": ["./styles/*"],
"@utils": ["./utils/index"],
"@utils/*": ["./utils/*"]
}
}
}
"extends": "./tsconfig.paths.json"
Utilizando Path Mapping no TypeScript
**const foo = <T,>(x: T) => x;**
// or
const foo = <T extends unknown>(x: T) => x;