Skip to content

Commit

Permalink
check for .d.ts files for absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
davidparkagoda committed May 18, 2020
1 parent 01bc8fd commit 783815f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export class UnusedComponent {}
3 changes: 3 additions & 0 deletions example/definition-files-absolute-paths/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Model } from 'models';

export class UnusedClassFromMain implements Model {}
2 changes: 2 additions & 0 deletions example/definition-files-absolute-paths/src/models.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export interface Model {
}
7 changes: 7 additions & 0 deletions example/definition-files-absolute-paths/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"baseDir": ".",
"compilerOptions": {
"baseUrl": "src"
},
"include": ["./src"]
}
4 changes: 4 additions & 0 deletions ispec/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ pushd ../example/simple
run_itest
popd

pushd ../example/definition-files-absolute-paths
run_itest
popd

pushd ../example/tsx
install_and_run_itest
popd
Expand Down
1 change: 1 addition & 0 deletions src/parser/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const relativeTo = (rootDir: string, file: string, path: string): string =>
const isRelativeToBaseDir = (baseDir: string, from: string): boolean =>
existsSync(resolve(baseDir, `${from}.js`)) ||
existsSync(resolve(baseDir, `${from}.ts`)) ||
existsSync(resolve(baseDir, `${from}.d.ts`)) ||
existsSync(resolve(baseDir, `${from}.tsx`)) ||
existsSync(resolve(baseDir, from, 'index.js')) ||
existsSync(resolve(baseDir, from, 'index.ts')) ||
Expand Down

0 comments on commit 783815f

Please sign in to comment.