Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for .d.ts files for absolute paths #141

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [6.2.2] - 1 Jun 2020

### Changed

- Fix: correctly check for `.d.ts` files when using absolute paths

## [6.2.1] - 1 Jun 2020

### Changed
Expand Down
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