typia icon indicating copy to clipboard operation
typia copied to clipboard

Nuxt 3 Integration

Open estnml opened this issue 2 years ago • 1 comments

Question

Hello, i am trying to use this library in nuxt 3 application. I followed the instructions on the webpage, but i am getting an error.

What i did

  1. pnpm install --save typia
  2. pnpm install --save-dev typescript ts-patch ts-node
  3. added "plugins": [{ "transform": "typia/lib/transform" }] to tsconfig.json
  4. added "prepare": "ts-patch install && typia patch" to package.json
  5. created templates and generated folders in the root.
  6. pnpm typia generate --input templates --output generated --project tsconfig.json
  7. modified nuxt.config.ts to auto import .ts files inside templates folder. added -> imports: {dirs: ["types/.ts", "templates/.ts"]},
  8. Created IRegisterUser interface in the templates folder.
  9. run "pnpm run prepare" command
  10. Inside the register.vue component:
const registerData = ref<IRegisterUser>({
    firstName: "",
    lastName: "",
    email: "",
    password: "",
    confirmPassword: ""
})

assert<IRegisterUser>(registerData.value);
  1. When i go to webpage, it does not open and in the console it says "Uncaught (in promise) Error: Error on typia.assert(): no transform has been configured. Read and follow https://typia.io/docs/setup please.".

I'm probably doing the setup wrong. I would be glad if you help.

estnml avatar Jan 19 '24 18:01 estnml

I tried following steps over here as well, and I could not get it to work.

Tenrys avatar Apr 10 '24 19:04 Tenrys

@estnml @Tenrys You can check this out https://typia.io/docs/setup/#unplugin-typia

ryoppippi avatar Jun 08 '24 09:06 ryoppippi

also duplicate of https://github.com/samchon/typia/issues/775

ryoppippi avatar Jun 08 '24 09:06 ryoppippi