Skip to content

Support TypeScript in vue template #1359

Closed
@xiaoxiangmoe

Description

@xiaoxiangmoe

What problem does this feature solve?

Support TypeScript expression in template

What does the proposed API look like?

<template>
  <h1>{{ msg }}</h1>
  <button @click="(count as number)++">count is: {{ (count as number) +  1 }}</button>
  <p>
    Edit <code>components/HelloWorld.vue</code> to test hot module replacement.
  </p>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue';

export default defineComponent({
  name: 'HelloWorld',
  setup: (props: { readonly msg: string }) => {
    const { msg } = props;
    const count = ref(0 as unknown);
    return { msg, count };
  },
});
</script>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions