nuxt / scripts

Plug-and-play script optimization for Nuxt applications. (Public Preview)
https://scripts.nuxt.com
MIT License
138 stars 9 forks source link

Typecheck fails in fresh project if `typescript.strict = false` #111

Open alexblunck opened 6 days ago

alexblunck commented 6 days ago

I am getting following Error when running npx nuxi typecheck in a fresh project with only @nuxt/scripts installed.

Error only occurs if typescript.strict ist set to false in nuxt.config.ts.

node_modules/@nuxt/scripts/dist/runtime/components/ScriptGoogleAdsense.vue:31:6 - error TS2322: Type '(any[] & { loaded: boolean; }) | undefined[]' is not assignable to type 'any[] & { loaded: boolean; }'.
  Type 'undefined[]' is not assignable to type 'any[] & { loaded: boolean; }'.
    Property 'loaded' is missing in type 'undefined[]' but required in type '{ loaded: boolean; }'.

31     (window.adsbygoogle = window.adsbygoogle || []).push({})
        ~~~~~~~~~~~~~~~~~~

  node_modules/@nuxt/scripts/dist/runtime/registry/google-adsense.d.ts:14:9
    14         loaded: boolean;
               ~~~~~~
    'loaded' is declared here.

Found 1 error in node_modules/@nuxt/scripts/dist/runtime/components/ScriptGoogleAdsense.vue:31

Reproduction: https://stackblitz.com/edit/nuxt-starter-8gr3ay