0.0.3 • Published 5 years ago
tsconfig-dva v0.0.3
tsconfig-dva
Installation
yarn
yarn add -D typescript tsconfig-dvanpm
npm install -D typescript tsconfig-dvaUsage
Add the following to your project's tsconfig.json
{
"extends": "tsconfig-dva"
}The suggested addition to tsconfig.json is baseUrl and paths configuration properties. This way you can use import statements to import project dependencies from the «top» entry point of the project (which is assumed to be src) is in the following way:
import { Link } from '@/components/Link';
export const Navigation = () => {
return (
<nav>
<Link to="/home">Home</Link>
<Link to="/profile">Profile</Link>
</nav>
);
};To allow such possibility add the following to your local tsconfig.json:
{
"compilerOptions": {
/* Module resolution */
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
}
}The full configuration with extended tsconfig-dva would look like this:
{
"extends": "tsconfig-dva",
"compilerOptions": {
/* Module resolution */
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
}
}