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

[Regression] Pass type as input type for function doesn't infer the correct type #1165

Closed
ahnpnl opened this issue Apr 11, 2022 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@ahnpnl
Copy link
Contributor

ahnpnl commented Apr 11, 2022

Summary

I have this sample code

<script setup lang="ts">
interface Foo {
    callMe(option: number): void;
}

defineExpose<Foo>({
    callMe(option) {
        console.log(option)
    }
})
</script>

Starting from 0.34.3 onwards, I got the error

error TS7006: Parameter 'option' implicitly has an 'any' type.

1 <template>

This error is not correct because option here is auto inferred type as number.

The bug doesn't happen with <= 0.34.2

Reproduce repo

@ahnpnl ahnpnl changed the title [Regression] Auto infer type for defineExpose no longer works [Regression] Pass type as input type for function doesn't infer the correct type Apr 11, 2022
@johnsoncodehk johnsoncodehk added the bug Something isn't working label Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants