Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

fix(nuxt): strip non-.vue extensions from component types - #7673

Merged
pi0 merged 1 commit into
mainfrom
fix/comp-type-exts
Sep 20, 2022
Merged

fix(nuxt): strip non-.vue extensions from component types#7673
pi0 merged 1 commit into
mainfrom
fix/comp-type-exts

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvesnuxt/nuxt#14853

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

As in other places, we need to strip file extensions for TS types in imports. In this case, we have to keep .vue as volar handles that.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroedanielroe added bug Something isn't working types 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Sep 20, 2022
@danielroe
danielroe requested a review from pi0September 20, 2022 08:03
@danielroedanielroe self-assigned this Sep 20, 2022
@netlify

netlifyBot commented Sep 20, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit7e73091
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/632973ddaa23dd0008103c5e

const componentTypes = options.getComponents().map(c => [
c.pascalName,
`typeof ${genDynamicImport(isAbsolute(c.filePath) ? relative(buildDir, c.filePath) : c.filePath, { wrapper: false })}['${c.export}']`
`typeof ${genDynamicImport(isAbsolute(c.filePath)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Refactor: We could introduce genTypeImport / genDynamicTypeImport that generates extension stripped imports and option for exception.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pi0
pi0 approved these changes Sep 20, 2022
@pi0
pi0 merged commit 347abcd into mainSep 20, 2022
@pi0
pi0 deleted the fix/comp-type-exts branch September 20, 2022 08:54
@pi0pi0 mentioned this pull request Sep 20, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't working🔨 p3-minor-bugPriority 3: a bug in an edge case that only affects very specific usagetypes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functional Component has type 'any'

2 participants

@danielroe@pi0