-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat): use tsconfig declarationDir is set (#468)
TSDX now uses `declarationDir` when found in `tsconfig.json`. This let you change where types declarations (and associated declaration maps) are emitted. It also allow you to get correct declaration maps (`.d.ts.map`) paths by setting `declarationDir` to the default `dist` output directory * Enable useTsconfigDeclarationDir if declarationDir * Rename fixture folder to be reused * Update test/fixtures/build-withTsconfig/tsconfig.json Co-Authored-By: Anton Gilgur <[email protected]> * Update test/fixtures/build-withTsconfig/tsconfig.json Co-Authored-By: Anton Gilgur <[email protected]> * Fix tests * Enable useTsconfigDeclarationDir if declarationDir * Rename fixture folder to be reused * Set rootDir to src and fix test Co-authored-by: Anton Gilgur <[email protected]>
- Loading branch information
1 parent
e2a91ad
commit b23f158
Showing
7 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"scripts": { | ||
"build": "tsdx build" | ||
}, | ||
"name": "build-withtsconfig", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const sum = (a: number, b: number) => { | ||
if ('development' === process.env.NODE_ENV) { | ||
console.log('fuck'); | ||
} | ||
return a + b; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { sum } from '../src'; | ||
|
||
describe('fuck', () => { | ||
it('works', () => { | ||
expect(sum(1, 1)).toEqual(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"lib": ["dom", "esnext"], | ||
"declaration": true, | ||
"declarationDir": "typings", | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"rootDir": "./src", | ||
"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": "./", | ||
"paths": { | ||
"*": ["src/*", "node_modules/*"] | ||
}, | ||
"jsx": "react", | ||
"esModuleInterop": true | ||
}, | ||
"include": ["src", "types"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters