Bug: tsr-declarations requires do not work with rootDir
See original GitHub issueIf I give a rootDir, and ask tsr to transpile a file that is not from the root directory, it assumes the tsr-declaration.js path incorrectly:
e.g.
tsr --tsConfig tsconfig.json src/types/assert.ts
will give the error
$ node lib/types/assert.js
Error: Cannot find module './tsr-declarations'
I think the core of this error is ts-runtime assumes I will always be generating runtime check files at the root of my repo. However, I just want runtime checks on a few functions in my repo that deal with user input.
tsconfig.json:
{
  "compilerOptions": {
    "rootDir": "./src",
    "outDir": "./lib/"
  },
  "include": ["src/**/*.ts"]
}
let me know if you want a reproducible repo, I can push one!
Issue Analytics
- State:
 - Created 5 years ago
 - Comments:9 (6 by maintainers)
 
Top Results From Across the Web
tsc should not care and fail with ts files outside of rootDir #9858
I have a fixtures folder which contains .ts files. In my tsconfig.json I set rootDir to src which does contain all my source...
Read more >File is not under 'rootDir' error in TypeScript | bobbyhadz
The "File is not under 'rootDir'" error occurs when we try to import something from a file that is not located under the...
Read more >unreferenced .ts file in project's root "is not under root dir"
I invoke it with ts-node when needed. This script is not referenced anywhere in the actual source. The actual source of my program...
Read more >TSConfig Option: rootDir - TypeScript
It would be an error to specify rootDir as core and include as * because it creates a file ( helpers.ts ) that...
Read more >TypeScript errors and how to fix them
You need to assign your type declaration using the = character: ... If you don't want client to be a function, you have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

great! Here is a sample repo
Closing due to inactivity. Feel free to pick this up again if there are any more questions.