vueuse/schema-org

type issues

sinisterstumble opened this issue · 5 comments

src/create-app.ts:2:34 - error TS2307: Cannot find module '@vueuse/schema-org-vite/vite' or its corresponding type declarations.

2 import { installSchemaOrg } from '@vueuse/schema-org-vite/vite'
import {
  useSchemaOrg,
  defineWebSite,
  defineOrganization
} from '@vueuse/schema-org/runtime'

Cannot find module '@vueuse/schema-org/runtime' or its corresponding type declarations.

Hey @markmartirosian

Not sure too why you would be getting the first error. The types are linked up correctly as far as I can tell, but I'll investigate this further soon.

As for the second issue, make sure you have dts: true in the Vite plugin, as it will write in your tsconfig the resolves path to this alias.

SchemaOrg({
      // ...
      // write type alias to tsconfig.json
      dts: true,
}),

Are you using any specific Vite framework that I can try and make a replication with?

@harlan-zw thank you! It's a generic vite, vue, ts, pnpm setup. I tired dts: true with the same effect. My suspicion is that it's related to pnpm, but I'm not sure.

A side question, is it possible to avoid aliases?

By default, the package.json alias @vueuse/schema-org/runtime should point to simple types.

    "./runtime": {
      "types": "./dist/runtime-simple/index.d.ts",
      "import": "./dist/runtime-simple/index.mjs"
    },

The dts: true should only be needed if you're switching to the full types (full: true), though sometimes it helps avoid type issues.

The alias is used for the 0kb runtime, you could try import directly from @vueuse/schema-org/runtime-simple or @vueuse/schema-org/dist/runtime-simple

I've implemented typeVersions in 1.1.0-beta.1 which may fix the issue, could you test with this version and let me know if you have any success

This should be resolved with v2. Let me know if you have any issues