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

fix(compiler-core): emit TS-compatible function declaration when requested #9363

Merged
merged 6 commits into from
May 30, 2024

Conversation

xesxen
Copy link
Contributor

@xesxen xesxen commented Oct 10, 2023

In our webpack setup, like in vuejs/vue-loader#1915, we're seeing TS7006: Parameter 'n' implicitly has an 'any' type. warnings for all of our <script type="ts" setup> vue modules with a <style lang="less" scoped> block in the same file.

Currently, genHoists is generating the following line:

const _withScopeId = n => (_pushScopeId("data-v-119f721c"),n=n(),_popScopeId(),n)

This patch adds an explicit parameter definition for the n parameter when valid typescript code is requested.

const _withScopeId = (n: () => any) => (_pushScopeId("data-v-119f721c"),n=n(),_popScopeId(),n)

@xesxen
Copy link
Contributor Author

xesxen commented Dec 24, 2023

bump :)

@xesxen
Copy link
Contributor Author

xesxen commented Jan 16, 2024

Resolved the merge conflicts

@Threebow
Copy link

Threebow commented Jan 27, 2024

+1

This is a very much-needed fix for those who depend on newer versions of vue-loader, and who (quite understandably) don't want to disable noImplicityAny or resort to other hacky methods as described in vuejs/vue-loader#1915

It should be a necessity to generate TS code that compiles with strict compiler options enabled in 2024.

packages/compiler-core/src/codegen.ts Outdated Show resolved Hide resolved
@haoqunjiang haoqunjiang added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Feb 4, 2024
Copy link

github-actions bot commented Feb 4, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.2 kB 34.4 kB 30.9 kB
vue.global.prod.js 147 kB 53.6 kB 47.8 kB

Usages

Name Size Gzip Brotli
createApp 50.3 kB 19.7 kB 18 kB
createSSRApp 53.7 kB 21 kB 19.1 kB
defineCustomElement 52.6 kB 20.4 kB 18.6 kB
overall 64 kB 24.8 kB 22.5 kB

@so1ve
Copy link
Member

so1ve commented Feb 18, 2024

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Feb 18, 2024

📝 Ran ecosystem CI: Open

suite result latest scheduled
language-tools success success
nuxt success success
pinia success failure
quasar success success
radix-vue success success
router failure success
test-utils success success
vant success success
vite-plugin-vue success success
vitepress success success
vue-i18n success success
vue-macros success success
vuetify success failure
vueuse success success
vue-simple-compiler success success

@haoqunjiang
Copy link
Member

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented May 30, 2024

📝 Ran ecosystem CI: Open

suite result latest scheduled
language-tools success success
nuxt success success
pinia success success
primevue success success
quasar success success
radix-vue success success
router success success
test-utils success success
vant success success
vite-plugin-vue success success
vitepress success success
vue-i18n success success
vue-macros success success
vuetify success success
vueuse success success
vue-simple-compiler success success

packages/compiler-core/src/codegen.ts Outdated Show resolved Hide resolved
@haoqunjiang haoqunjiang merged commit 5d25850 into vuejs:main May 30, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. scope: compiler
Projects
Development

Successfully merging this pull request may close these issues.

7 participants