typia
typia copied to clipboard
Nuxt 3 Integration
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
- pnpm install --save typia
- pnpm install --save-dev typescript ts-patch ts-node
- added "plugins": [{ "transform": "typia/lib/transform" }] to tsconfig.json
- added "prepare": "ts-patch install && typia patch" to package.json
- created templates and generated folders in the root.
- pnpm typia generate --input templates --output generated --project tsconfig.json
- modified nuxt.config.ts to auto import .ts files inside templates folder. added -> imports: {dirs: ["types/.ts", "templates/.ts"]},
- Created IRegisterUser interface in the templates folder.
- run "pnpm run prepare" command
- Inside the register.vue component:
const registerData = ref<IRegisterUser>({
firstName: "",
lastName: "",
email: "",
password: "",
confirmPassword: ""
})
assert<IRegisterUser>(registerData.value);
- 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.
I tried following steps over here as well, and I could not get it to work.
@estnml @Tenrys You can check this out https://typia.io/docs/setup/#unplugin-typia
also duplicate of https://github.com/samchon/typia/issues/775