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

feat: types auto import #218

Merged
merged 2 commits into from
Feb 7, 2023
Merged

feat: types auto import #218

merged 2 commits into from
Feb 7, 2023

Conversation

antfu
Copy link
Member

@antfu antfu commented Feb 7, 2023

Resolve nuxt/nuxt#12808 (comment)
Resolve unplugin/unplugin-auto-import#61

It seems to work with my TypeScript v4.9.5, not even requiring 5.0.

@antfu antfu requested review from danielroe and pi0 February 7, 2023 10:10
@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Merging #218 (45c41d6) into main (16b182e) will decrease coverage by 0.06%.
The diff coverage is 97.05%.

@@            Coverage Diff             @@
##             main     #218      +/-   ##
==========================================
- Coverage   99.22%   99.16%   -0.06%     
==========================================
  Files          65       66       +1     
  Lines        2590     2648      +58     
  Branches      378      391      +13     
==========================================
+ Hits         2570     2626      +56     
- Misses         20       22       +2     
Impacted Files Coverage Δ
src/utils.ts 97.22% <84.61%> (-0.60%) ⬇️
src/context.ts 98.20% <100.00%> (+0.05%) ⬆️
src/global.ts 93.54% <100.00%> (ø)
src/preset.ts 95.83% <100.00%> (ø)
src/types.ts 100.00% <100.00%> (ø)
test/dts.test.ts 100.00% <100.00%> (ø)
test/fixtures.test.ts 100.00% <100.00%> (ø)
test/fixtures/no-type.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯 This is phenomenal. Tested and working locally in Nuxt in IDE and in nuxi typecheck with:

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  imports: {
    imports: [
      {
        name: 'Ref',
        type: true,
        from: 'vue'
      }
    ]
  }
})

@antfu antfu merged commit f33f085 into main Feb 7, 2023
@antfu antfu deleted the feat/types branch February 7, 2023 10:41
@userquin
Copy link

userquin commented Feb 7, 2023

🤯 This is phenomenal. Tested and working locally in Nuxt in IDE and in nuxi typecheck with:

Also working on IntelliJ Ultimate Edition:

imagen

imagen

But auto imports seems to be broken:

imagen

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

Successfully merging this pull request may close these issues.

Auto import for types like Ref RFC: Auto register for types
3 participants