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

typeRoots are not resolved when types are present #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
1 change: 0 additions & 1 deletion example.ts

This file was deleted.

86 changes: 86 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"dependencies": {
"ts-node": "latest",
"typescript": "latest"
"typescript": "latest",
"dnscache": "1.0.2",
"@types/node": "latest"
},
"scripts": {
"start": "node dist/index.js",
"ts-node": "ts-node src/index.ts",
"ts-node--files": "ts-node --files src/index.ts",
"tsc": "tsc"
}
}
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
n lts

# Install package.json dependencies
yarn
npm i

# Run ts-node
yarn ts-node ./example.ts
npm run ts-node

echo "Process exited with code: $?"
echo
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import dnscache from 'dnscache';

dnscache({});

console.log('done');
17 changes: 17 additions & 0 deletions src/typings/dnscache/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
declare module 'dnscache' {
export default function dnscache(conf: {
enable?: boolean;
ttl?: number;
cachesize?: number;
}): void;
}

// declare module 'dnscache' {
// function dnscache(conf: {
// enable?: boolean;
// ttl?: number;
// cachesize?: number;
// }): void;
//
// export = dnscache;
// }
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"outDir": "dist",
"types": ["node"],
"typeRoots": [
"node_modules/@types",
"src/typings"
]
}
}