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): make ForIteratorExpression's returns property optional #11011

Merged
merged 1 commit into from
May 27, 2024

Conversation

so1ve
Copy link
Member

@so1ve so1ve commented May 24, 2024

Upstream: vuejs/language-tools#4409

Usage here:

const loop = createFunctionExpression(
createForLoopParams(forNode.parseResult, [
createSimpleExpression(`_cached`),
]),
)
loop.body = createBlockStatement([
createCompoundExpression([`const _memo = (`, memo.exp!, `)`]),
createCompoundExpression([
`if (_cached`,
...(keyExp ? [` && _cached.key === `, keyExp] : []),
` && ${context.helperString(
IS_MEMO_SAME,
)}(_cached, _memo)) return _cached`,
]),
createCompoundExpression([`const _item = `, childBlock as any]),
createSimpleExpression(`_item.memo = _memo`),
createSimpleExpression(`return _item`),
])
shows that a ForIteratorExpression's returns property can be undefined, so changed the type definition to match the runtime result.

upstream: vuejs/language-tools#4409

Usage here: https://github.com/vuejs/core/blob/530d9ec5f69a39246314183d942d37986c01dc46/packages/compiler-core/src/transforms/vFor.ts#L206-L223 shows that a `ForIteratorExpression`'s `returns` property can be `undefined`, so changed the type definition to match the runtime result.
@so1ve so1ve changed the title fix: make ForIteratorExpression's returns property optional fix(compiler-core): make ForIteratorExpression's returns property optional May 24, 2024
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.8 kB 34.5 kB 31.1 kB
vue.global.prod.js 148 kB 53.7 kB 48 kB

Usages

Name Size Gzip Brotli
createApp 50.8 kB 19.9 kB 18.1 kB
createSSRApp 54.1 kB 21.2 kB 19.3 kB
defineCustomElement 53.1 kB 20.6 kB 18.8 kB
overall 64.6 kB 24.9 kB 22.6 kB

@so1ve
Copy link
Member Author

so1ve commented May 24, 2024

e2e failed 🤔

@sxzz
Copy link
Member

sxzz commented May 25, 2024

Re-ran and passed now

@sodatea
Copy link
Member

sodatea commented May 27, 2024

/ecosystem-ci run

@vue-bot
Copy link

vue-bot commented May 27, 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

@sodatea sodatea merged commit 5b8c1af into vuejs:main May 27, 2024
11 checks passed
@so1ve so1ve deleted the fix/for-iterator-returns-maybe-undefined branch May 27, 2024 10:00
wangdaoo pushed a commit to wangdaoo/core that referenced this pull request May 30, 2024
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.

None yet

4 participants