-
Notifications
You must be signed in to change notification settings - Fork 150
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
TypeScript not being processed when no filename is given #488
Comments
Is the request that the preprocessor blindly strip types without any checking of there is no filename? I'm not sure what else it could do. I'm also not sure whether that could cause problems with enums or any other language features. |
That would be an improvement over leaving the annotation in and getting |
Not sure if my issue relates to this but when I do this:
then load the parent component, I get this error:
Edit 1: nvm, fixed the issue by renaming |
- breaking: remove TS mixed imports support, require TS 5.0 or higher - breaking: require Svelte 4+, Node 18+ - breaking: add exports map - fix: adjust type import - fix: remove pug types from dependencies - fix: allow TS filename to be undefined, fixes #488 - chore: replace jest with vitest - chore: relax eslint config - chore: bump peer deps, fixes #553, closes#635 - chore: update CI, closes #638 - chore: get rid of magic-string as it's no longer used, bump node types - docs: migration info
Describe the bug
if (filename == null) return { code: content };
in svelte-preprocess/src/transformers/typescript.ts line 497 is the issue.
To Reproduce
Call
svelte.preprocess(code, processor)
manually without providing the third optional parameter ( omitting the filename )https://github.com/wangjia184/svelte-parser/blob/master/src/worker.ts (not mine, not small)
Expected behavior
when inputing
const x : number = 1
the output to beconst x = 1
, even when no filename was provided.Additional context
When you provide a weird filename like
" "
then the preprocessor will work and remove the type annotations.The text was updated successfully, but these errors were encountered: