This project was initialized with vue-ts
template:
$ npm init vite@latest vite-babylonjs --template vue-ts
Then I just shamelessly copied parts of troij.js
The result to me was that it looks like getting the basics was fairly easy (if you can overlook some hacks in place to get a scene rendering :) ). If I went further with this project then I would look at generating the types like I do in
react-babylonjs
, but strongly typed using genericsdefineComponent<T>(...)
instead ofdefineComponent({props: ...})
. I like how the plugins mechanism works, but would want to look for a way that would take advantage of tree-shaking.
Vue 3 + Typescript + Vite
This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 <script setup>
SFCs, check out the script setup docs to learn more.
Recommended IDE Setup
.vue
Imports in TS
Type Support For Since TypeScript cannot handle type information for .vue
imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue
imports (for example to get props validation when using manual h(...)
calls), you can enable Volar's .vue
type support plugin by running Volar: Switch TS Plugin on/off
from VSCode command palette.