You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The index.ts file contains simply console.log("hello").
Upon running script yarn build from packages/package, I get this error:
in package % yarn build
error TS2688: Cannot find type definition file for 'node'.
The file is in the program because:
Entry point of type library 'node' specified in compilerOptions
tsconfig.json:28:15
28 "types": ["node"],
~~~~~~
File is entry point of type library specified here.
Found 1 error.
I was hoping to extract all build tools (tsc, jest, eslint) to a separate (parent) workspace and keep all required dependencies there.
But it looks like I still have to declare in every child workspace dev dependencies @types/*.
I have also tried adding this to workspace package package.json:
"devDependencies": {
"@repro/packages": "*"
}
Removing types from compilerOptions changes the error to
in package % yarn build
src/index.ts:1:1 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the 'lib' compiler option to include 'dom'.
1 console.log("hello")
~~~~~~~
Found 1 error in src/index.ts:1
What am I missing? Do I really have to define dev dependencies @types/* in each workspace that want to use that shared script?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have been trying to follow this Yarn Berry shared scripts practice , based on @arcanis comment here:
My setup is like so:
Yarn: 3.3.1, Zero Installs
Typescript: 4.9.5
Node: 18.13.0
with root package.json:
worktree
packages
package.json:and workspace
package
package.json:and
tsconfig.json
:The index.ts file contains simply
console.log("hello")
.Upon running script
yarn build
frompackages/package
, I get this error:I was hoping to extract all build tools (tsc, jest, eslint) to a separate (parent) workspace and keep all required dependencies there.
But it looks like I still have to declare in every child workspace dev dependencies
@types/*
.I have also tried adding this to workspace
package
package.json:Removing
types
fromcompilerOptions
changes the error toWhat am I missing? Do I really have to define dev dependencies
@types/*
in each workspace that want to use that shared script?I have asked on StackOverflow as well.
Beta Was this translation helpful? Give feedback.
All reactions