DEV Community

Discussion on: Boilerplate: NuxtJS + Express server + Jest, all in Typescript

Collapse
 
madhusudanbabar profile image
Krypton | Madhusudan Babar

Can you share how can we create components in TypeScript but without using classes or decorators,
There's very litte documentation on how to do it with options API or using Vue.extend.

Collapse
 
svitekpavel profile image
Pavel Svitek

See my comments in README. I didn't want to use classes either, so I explored pros and cons. Read here
github.com/svitekpavel/nuxtjs-expr...

And see implementations here:
github.com/svitekpavel/nuxtjs-expr...

And class approach here:
github.com/svitekpavel/nuxtjs-expr...

I also like the first approach - Vue.extend() better, because it seems that class approach has too much boiler code around it.

Collapse
 
madhusudanbabar profile image
Krypton | Madhusudan Babar • Edited

Yeah, the classes API feels somewhat complicated and needs extra imports and all,
I was stuck at importing the components using options API,
But later i figured it out that it was just because that i also needed to add .vue extension while importing the components,
BTW thanks for the reply 😇.
And your repo is really great for understanding express in nuxt.

Thread Thread
 
svitekpavel profile image
Pavel Svitek

Great, I'm glad it helped. I'd appreciate if you share with more people.