RFC: Auto register for types
See original GitHub issueContext:
- https://github.com/antfu/unplugin-auto-import/pull/60#issuecomment-939341877
- https://github.com/antfu/vue-global-api/issues/10
For example, it would be great to have common types like Ref
, ComputedRef
globally available when using the Vue preset. I would expect the API to be like
{
// auto importing for import
imports: [
'vue'
],
// auto importing for types
types: [
'vue', // again, we could have presets for it.
{
vue: ['Ref', 'ComputedRef']
}
]
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:45
- Comments:10 (2 by maintainers)
Top Results From Across the Web
RFC 4589 - Location Types Registry - IETF Datatracker
RFC 4589 Location Types Registry July 2006 1. Introduction This document creates a registry for location type tokens. We anticipate that the network, ......
Read more >RFC 6838: Media Type Specifications and Registration ...
This document specifies the criteria for media type registrations and defines the procedures to be used to register media types (Section 5) as...
Read more >Protocol Registries - Internet Assigned Numbers Authority
To obtain a registration in an existing registry, or to modify existing registrations, consult the relevant application form. For information on creating ...
Read more >FAQs: What is Mexico's RFC, and What is it Used For?
The RFC is a registration number issued by Mexico's tax ... you are granted legal residency in Mexico you are automatically assigned a...
Read more >Register targets with your target group - Elastic Load Balancing
For more information, see Attaching a load balancer to your Auto Scaling group ... The target type of your target group determines how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@antfu Maybe I misunderstood, but is this not what you want?
imports.d.ts
is commented out)Both seems to work, at least to my needs:
Ref<number>
inindex.ts
has hinttype Ref<T> = Ref<any>
imports.d.ts
orglobal.d.ts
imports.d.ts
orglobal.d.ts
onV.Ref
orimport('vue').Ref
leads to definitions in Vue.I’m happy with that.
Right now I include global types on
d.ts
file using:maybe we can use this another approach as suggested on issue on
vue-global-api
repo (both approaches work inIntelliJ
, this latter would simplify the logic to generate thed.ts
file and avoid adding redundant imports):