Vue: Feature Updates

Spanish audio is available in the player settings
Rate this content
Bookmark

The creator of Vue js gives an update on the new features of the technology.

FAQ

Vue 3.3 is a recent update to the Vue.js framework, focusing on improving the development experience with script setup in single file components and TypeScript. It includes features like imported type support for defining props, generic components, and more ergonomic define emits.

Vue 3.3 enhances TypeScript integration by improving type support in several areas, including the ability to use imported types when defining props and the introduction of generic components. These improvements aim to facilitate cross-team productivity and maintainability in large projects.

Generic components in Vue 3.3 allow developers to specify types that are flexible and reusable, enhancing the capability to build dynamic and complex components. This feature uses TypeScript generics to ensure type safety across different parts of a component or application.

The delay in releasing Vue 3.3 after Vue 3.2 was primarily due to the Vue team's focus on developing Vite and other related projects, as well as enhancements in the IDE side of the ecosystem, such as developing language tools like Volar.

Vue 3.3 addresses challenges in handling imported types by enhancing the compiler's ability to analyze and resolve these types. This includes dealing with various import scenarios, such as relative paths and npm packages, which helps in correctly generating runtime props lists.

Vue 3.3 introduces more ergonomic define emits that simplify the syntax and improve type inference. This update uses labeled tuple syntax to provide better type information and readability, enhancing the overall developer experience when defining component events.

Future plans for Vue.js include continued work on Vapor mode for more efficient code generation, improvements to Vue core, and focusing on native app scoped CSS and async context handling. These developments aim to simplify and enhance performance in Vue applications.

Evan You
Evan You
44 min
12 May, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The Talk discusses the recent feature updates in Vue 3.3, focusing on script setup and TypeScript support. It covers improvements in defining props using imported types and complex types support. The introduction of generic components and reworked signatures for defined components provides more flexibility and better type support. Other features include automatic inference of runtime props, improved define emits and defined slots, and experimental features like reactive props destructure and define model. The Talk also mentions future plans for Vue, including stabilizing suspense and enhancing computer invalidations.

1. Introduction to Vue 3.3 and TypeScript Support

Short description:

Hello, UK! Today, I'm talking about the recent feature update in Vue 3.3. The focus was improving the development experience with script setup and TypeScript. Vue initially didn't support TypeScript, but as the user base grew, we rethought parts of the framework to accommodate complex applications. Good TypeScript support enhances cross-team productivity and long-term maintainability.

Hello, UK! So it's my first time in the UK, first time in London, super excited to be here! We had a bus tour yesterday, I didn't really have much opportunity to walk around myself yet, but it's really been a very eye-opening experience, a lot of history here, so super excited and super excited to connect with all the developers from here, and also from all around wherever you are coming from!

So today, I'm going to be talking about the feature update that's happening recently in Vue, and in case you don't know yet, Vue 3.3 was just released yesterday. So this was the first minor release in quite a very long time, so 3.2 was actually released more than a year ago, and one of the reasons for that was because we spent a lot of time working on Vite and other related projects. We invested a lot of time in, say, the IDE side of things, making the language tools, Volar and everything, braining up the whole development experience around the tooling ecosystem around the Vue core. But now we're moving our attention back to the Vue core, and you're going to see more frequent releases from Vue core after this one. So this is the start of a lot of new stuff that's coming. So let's take a look at 3.3.

The focus of this release was, again, improving the development experience when you're using script setup in single file components and TypeScript. Now, don't get mad at me if you don't use TypeScript. I think, obviously, when Vue just started we didn't even support TypeScript. In fact, a lot of the initial APIs weren't even designed with TypeScript in mind. So, over time, we had to slowly rethink parts of the framework to think about, oh, how does this API work with TypeScript? When we introduce new APIs, how will these new APIs work with TypeScript? And the reason for that is because in the initial stages when Vue was relatively small, our user base was mostly focused on relatively simple use cases. They were largely using a back-end framework and they just wanted some simple interactivity on the front-end. But nowadays, our use case has expanded wildly and people are building really complex applications with Vue. And in situations like that, when you have large projects, big teams, a lot of people working together with varying level of experience, having a type system and having good development experience with TypeScript is going to help you a lot with the cross-team productivity and long-term maintainability of your applications. So we believe this is a really important thing that we want to really nail, and there has historically been a few pain points in Vue when you're using Vue with TypeScript, which we believe we have largely resolved in this release.

2. Imported Types for Defining Props

Short description:

Since the introduction of Script Setup, one of the most wanted features in Vue 3.2 is the ability to use imported types when defining props. The view compiler analyzes the types provided to define props and determines the props that the component expects at runtime. The compiler generates the correct runtime props list, ensuring that the app works.

So probably one of the most wanted features since 3.2, since the introduction of Script Setup is the ability to use imported types when defining props. Now this example here actually worked in 3.2 when you import a type from another file and use it in DefineProps with the type declaration syntax.

Some background here, the reason why we need to do something special with types here is because at runtime, a view component needs to know the explicit list of props that it is expected to receive. So without that information it won't be able to tell whether something it receives should be treated as a prop versus just a fall-through attribute.

This is the reason why the view compiler needs to look at the types you provided to define props, and then try to analyze what props this component expects to receive at runtime. Here, just by looking at the syntax, you'd notice that it's very easy to determine that message msg is the only thing that this component expects. It's deterministic, so the compiler says, OK, I've already figured out message is going to be an expected prop. Even if I'm not able to completely infer what this external type is, it doesn't prevent me from generating the correct runtime props list, so that your app will just work, right? Because in production, we don't really do runtime props validation based on these types here.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Everything Beyond State Management in Stores with Pinia
Vue.js London Live 2021Vue.js London Live 2021
34 min
Everything Beyond State Management in Stores with Pinia
Top Content
When we think about Vuex, Pinia, or stores in general we often think about state management and the Flux patterns but not only do stores not always follow the Flux pattern, there is so much more about stores that make them worth using! Plugins, Devtools, server-side rendering, TypeScript integrations... Let's dive into everything beyond state management with Pinia with practical examples about plugins and Devtools to get the most out of your stores.
Welcome to Nuxt 3
Vue.js London Live 2021Vue.js London Live 2021
29 min
Welcome to Nuxt 3
Top Content
Explain about NuxtJS codebase refactor and challenges facing to implement Vue 3, Vite and other packages.
One Year Into Vue 3
Vue.js London Live 2021Vue.js London Live 2021
20 min
One Year Into Vue 3
Top Content
Vue 3 may still sound new to many users, but it's actually been released for over a year already. How did Vue 3 evolve during this period? Why did it take so long for the ecosystem to catch up? What did we learn from this process? What's coming next? We will discuss these questions in this talk!
Utilising Rust from Vue with WebAssembly
Vue.js London Live 2021Vue.js London Live 2021
8 min
Utilising Rust from Vue with WebAssembly
Top Content
Rust is a new language for writing high-performance code, that can be compiled to WebAssembly, and run within the browser. In this talk you will be taken through how you can integrate Rust, within a Vue application, in a way that's painless and easy. With examples on how to interact with Rust from JavaScript, and some of the gotchas to be aware of.
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
How many times did you implement the same flow in your application: check, if data is already fetched from the server, if yes - render the data, if not - fetch this data and then render it? I think I've done it more than ten times myself and I've seen the question about this flow more than fifty times. Unfortunately, our go-to state management library, Vuex, doesn't provide any solution for this.For GraphQL-based application, there was an alternative to use Apollo client that provided tools for working with the cache. But what if you use REST? Luckily, now we have a Vue alternative to a react-query library that provides a nice solution for working with server cache. In this talk, I will explain the distinction between local application state and local server cache and do some live coding to show how to work with the latter.
Stop Writing Your Routes
Vue.js London 2023Vue.js London 2023
30 min
Stop Writing Your Routes
The more you keep working on an application, the more complicated its routing becomes, and the easier it is to make a mistake. ""Was the route named users or was it user?"", ""Did it have an id param or was it userId?"". If only TypeScript could tell you what are the possible names and params. If only you didn't have to write a single route anymore and let a plugin do it for you. In this talk we will go through what it took to bring automatically typed routes for Vue Router.

Workshops on related topic

Vue3: Modern Frontend App Development
Vue.js London Live 2021Vue.js London Live 2021
169 min
Vue3: Modern Frontend App Development
Top Content
Featured WorkshopFree
Mikhail Kuznetcov
Mikhail Kuznetcov
The Vue3 has been released in mid-2020. Besides many improvements and optimizations, the main feature of Vue3 brings is the Composition API – a new way to write and reuse reactive code. Let's learn more about how to use Composition API efficiently.

Besides core Vue3 features we'll explain examples of how to use popular libraries with Vue3.

Table of contents:
- Introduction to Vue3
- Composition API
- Core libraries
- Vue3 ecosystem

Prerequisites:
IDE of choice (Inellij or VSC) installed
Nodejs + NPM
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Vue.js London Live 2021Vue.js London Live 2021
117 min
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Top Content
Workshop
Daniel Roe
Daniel Roe
We'll build a Nuxt project together from scratch using Nitro, the new Nuxt rendering engine, and Nuxt Bridge. We'll explore some of the ways that you can use and deploy Nitro, whilst building a application together with some of the real-world constraints you'd face when deploying an app for your enterprise. Along the way, fire your questions at me and I'll do my best to answer them.
Going on an adventure with Nuxt 3, Motion UI and Azure
JSNation 2022JSNation 2022
141 min
Going on an adventure with Nuxt 3, Motion UI and Azure
WorkshopFree
Melanie de Leeuw
Melanie de Leeuw
We love easily created and deployed web applications! So, let’s see what a very current tech stack like Nuxt 3, Motion UI and Azure Static Web Apps can do for us. It could very well be a golden trio in modern day web development. Or it could be a fire pit of bugs and errors. Either way it will be a learning adventure for us all. Nuxt 3 has been released just a few months ago, and we cannot wait any longer to explore its new features like its acceptance of Vue 3 and the Nitro Engine. We add a bit of pizzazz to our application with the Sass library Motion UI, because static design is out, and animations are in again.Our driving power of the stack will be Azure. Azure static web apps are new, close to production and a nifty and quick way for developers to deploy their websites. So of course, we must try this out.With some sprinkled Azure Functions on top, we will explore what web development in 2022 can do.
TresJS create 3D experiences declaratively with Vue Components
Vue.js London 2023Vue.js London 2023
137 min
TresJS create 3D experiences declaratively with Vue Components
Workshop
Alvaro Saburido
Alvaro Saburido
- Intro 3D - Intro WebGL- ThreeJS- Why TresJS- Installation or Stackblitz setup - Core Basics- Setting up the Canvas- Scene- Camera- Adding an object- Geometries- Arguments- Props- Slots- The Loop- UseRenderLoop composable- Before and After rendering callbacks- Basic Animations- Materials- Basic Material- Normal Material- Toon Material- Lambert Material- Standard and Physical Material- Metalness, roughness - Lights- AmbientLight- DirectionalLight- PointLights- Shadows- Textures- Loading textures with useTextures- Tips and tricks- Misc- Orbit Controls- Loading models with Cientos- Debugging your scene- Performance
Building Vue forms with VeeValidate
Vue.js London Live 2021Vue.js London Live 2021
176 min
Building Vue forms with VeeValidate
Workshop
Abdelrahman Awad
Abdelrahman Awad
In this workshop, you will learn how to use vee-validate to handle form validation, manage form values and handle submissions effectively. We will start from the basics with a simple login form all the way to using the composition API and building repeatable and multistep forms.

Table of contents:
- Introduction to vee-validate
- Building a basic form with vee-validate components
- Handling validation and form submissions
- Building validatable input components with the composition API
- Field Arrays and repeatable inputs
- Building a multistep form
Prerequisites:
VSCode setup and an empty Vite + Vue project.