nuxt / scripts

Third-Party Scripts Meets Nuxt Developer Experience.
https://scripts.nuxt.com
MIT License
290 stars 41 forks source link

ERROR(vue-tsc) Binding element 'Vimeo' implicitly has an 'any' type. #256

Closed ifrvn closed 1 month ago

ifrvn commented 1 month ago

๐Ÿ› The bug

 ERROR(vue-tsc)  Binding element 'Vimeo' implicitly has an 'any' type.
 FILE  D:/dev/test1/node_modules/.pnpm/@nuxt+scripts@0.8.4_@nuxt+devtools@1.4.1_rollup@4.21.2_vite@5.4.3_@types+node@22.5.4_terser@5_npscaliduljzxdqaosyipgid7y/node_modules/@nuxt/scripts/dist/runtime/components/ScriptVimeoPlayer.vue:187:21

    185 |
    186 | onMounted(() => {
  > 187 |   onLoaded(async ({ Vimeo }) => {
        |                     ^^^^^
    188 |     const vimeoOptions = props.vimeoOptions || {}
    189 |     if (!vimeoOptions.id && props.id) {
    190 |       vimeoOptions.id = props.id

 ERROR(vue-tsc)  Parameter 'instance' implicitly has an 'any' type.
 FILE  D:/dev/test1/node_modules/.pnpm/@nuxt+scripts@0.8.4_@nuxt+devtools@1.4.1_rollup@4.21.2_vite@5.4.3_@types+node@22.5.4_terser@5_npscaliduljzxdqaosyipgid7y/node_modules/@nuxt/scripts/dist/runtime/components/ScriptYouTubePlayer.vue:61:19    

    59 | }
    60 | onMounted(() => {
  > 61 |   onLoaded(async (instance) => {
       |                   ^^^^^^^^
    62 |     const YouTube: typeof YT & { ready: (fn: () => void) => void } = await instance.YT
    63 |     await new Promise<void>((resolve) => {
    64 |       if (typeof YT.Player === 'undefined')

[vue-tsc] Found 2 errors. Watching for file changes.

image

When using Nuxt Devtools in typescript strict mode and enabling type check, these two errors will be occurred.

export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: ['@nuxt/scripts'],
  typescript: {
    typeCheck: true,
    strict: true
  },
})

I think this might be related to https://github.com/nuxt/scripts/issues/217#issuecomment-2336846827. These are same errors as what in that comment.

Versions: @nuxt/scripts: 0.8.4 @nuxt/devtools : 1.4.1 vue-tsc: 2.0.29

๐Ÿ› ๏ธ To reproduce

https://stackblitz.com/~/github.com/ifrvn/nuxt-scripts-issue-test

๐ŸŒˆ Expected behavior

no error

โ„น๏ธ Additional context

No response

harlan-zw commented 1 month ago

Hi, thank you for the detailed issue.

This appears to be fixed in 0.8.5.