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

Remove @babel/preset-typescript #95

Open
lxsmnsyc opened this issue Mar 20, 2023 · 4 comments
Open

Remove @babel/preset-typescript #95

lxsmnsyc opened this issue Mar 20, 2023 · 4 comments

Comments

@lxsmnsyc
Copy link
Member

lxsmnsyc commented Mar 20, 2023

@ryansolid
Copy link
Member

I didn't write this plugin so I can't speak to it. But assuming we don't do the TS conversion the expectation is the downstream tool does? Can we make that assumption. I'm open to this if we know Vite will just handle this for the files we process. I wonder if there are any other implications. I trust you if you've tested this.

@lxsmnsyc
Copy link
Member Author

The transform step in the link I gave is actually based on what Prefresh does in their Vite plugin: https://github.com/preactjs/prefresh/blob/main/packages/vite/src/index.js#L27-L34

so if anything, they have tested this more realistically. It works as I've tested. My only concern really here is if anyone actually uses the typescript option in the plugin, in which case we can just recommend users to install @babel/preset-typescript on their own.

@Eptagone
Copy link

Hi. I actually use typescript option for this:

solid({
    typescript: {
        allowDeclareFields: true,
    },
})

Otherwise, my build fails because declare is not allowed without that setting

4:42:58 PM [vite] Internal server error: /home/eptadot/source/md-web-widgets-elec-2024/assets/stimulus/controllers/Form/CandidateCollectionController/index.tsx: The 'declare' modifier is only allowed when the 'allowDeclareFields' option of @babel/plugin-transform-typescript or @babel/preset-typescript is enabled.
  23 |      
> 24 |     declare readonly nameValue: string;

Can I use declare without that setting after removing @babel/preset-typescript? I suppose yes but I want to be sure.

@lxsmnsyc
Copy link
Member Author

yes you can. The new setup just enables Babel to understand TypeScript syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants