0.0.3 • Published 3 years ago

tsconfig-dva v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

tsconfig-dva

npm version

Installation

yarn

yarn add -D typescript tsconfig-dva

npm

npm install -D typescript tsconfig-dva

Usage

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/*"] }
    }
}
0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago