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

Rename @hmr module for TypeScript tooling compatibility #92

Closed
bates64 opened this issue May 8, 2020 · 1 comment
Closed

Rename @hmr module for TypeScript tooling compatibility #92

bates64 opened this issue May 8, 2020 · 1 comment

Comments

@bates64
Copy link
Contributor

bates64 commented May 8, 2020

Is your feature request related to a problem? Please describe.
TypeScript editor tools complain that they Cannot find module '@hmr'.:

VSCodium

Describe the solution you'd like
Move or alias @hmr to vite/hmr. Then, typings can be provided from the vite package itself.

import { hot } from 'vite/hmr'

// TypeScript knows what `hot` is now!

Describe alternatives you've considered
Users can declare the @hmr module themselves in a .d.ts file:

declare module '@hmr' {
	export const hot: {
		// accept, dispose, on, etc.
	}
}

This requires duplicating type information already available in client.ts and breaks projects if the hmr API changes.

Additional context
It may also be worth allowing __DEV__ to be imported from a module such as vite/env. This would also free TypeScript users from having to declare a global boolean in a declaration file.

@bates64 bates64 changed the title Rename @hmr module for TypeScript compatibility Rename @hmr module for TypeScript tooling compatibility May 8, 2020
@yyx990803
Copy link
Member

closed via eab49a4

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants