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
Describe the bug
when attempting to type check svelte.config.js with typescript, i get the following error:
> tsc -p tsconfig.json
node_modules/svelte-preprocess/dist/types/options.d.ts:4:55 - error TS7016: Could not find a declaration file for module '@babel/core'. 'C:/Users/amogus/IdeaProjects/network-chungus/node_modules/@babel/core/lib/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/babel__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@babel/core';`
4 import type { TransformOptions as BabelOptions } from '@babel/core';
~~~~~~~~~~~~~
because @types/babel__core is required by users downstream (if they're using typescript), i'd suggest moving it to dependencies instead of devDependencies. otherwise users will have to manually add @types/babel__core to their package.json to get rid of the errors.
// tsconfig.json
{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"skipLibCheck": false//although changing this to true would also fix the problem, i try to avoid it at all costs because it's dangerous
}
}
Expected behavior
all dependencies required for type checking downstream are included in dependencies
Information about your project:
Your browser and the version: n/a
Your operating system: n/a
svelte-preprocess version: 4.10.5
Whether your project uses Webpack or Rollup: vite (which i think uses rollup? idk im new)
Mhm this is tricky. We don't want to do that because these types are only relevant when using the babel preprocessor. But since the type definitions are static, we can't model that. Maybe we need to add comments that tell TS to ignore the type errors.
but yeah i agree it's a tough situation, ideally you could have conditional dependencies based on whether you're using the babel preprocessor but i don't think npm supports such a thing
Describe the bug
when attempting to type check
svelte.config.js
with typescript, i get the following error:because
@types/babel__core
is required by users downstream (if they're using typescript), i'd suggest moving it todependencies
instead ofdevDependencies
. otherwise users will have to manually add@types/babel__core
to theirpackage.json
to get rid of the errors.To Reproduce
Expected behavior
all dependencies required for type checking downstream are included in
dependencies
Information about your project:
Your browser and the version: n/a
Your operating system: n/a
svelte-preprocess
version: 4.10.5Whether your project uses Webpack or Rollup: vite (which i think uses rollup? idk im new)
Additional context
see openapi-library/OpenAPIValidators#258 (comment) for more info
The text was updated successfully, but these errors were encountered: