Subscribe on changes!

How can I init props with <script setup lang="ts">?

avatar
Sep 22nd 2020

Version

3.0.0

Reproduction link

https://jsfiddle.net/r3dge1o7/

<script setup="props" lang="ts">

type HiButtonType = 'primary' | 'warning' | 'default';

declare const props: {
  type?: HiButtonType;
};
props.type = props.type || 'primary';
</script>

Steps to reproduce

declare const props:{type: string}; props.type = props.type || 'test';

What is expected?

cant init props column.

What is actually happening?

How init prop?

avatar
Sep 22nd 2020

Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.


https://github.com/vuejs/rfcs/blob/sfc-improvements/active-rfcs/0000-sfc-script-setup.md#with-typescript

avatar
Sep 22nd 2020

Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.

https://github.com/vuejs/rfcs/blob/sfc-improvements/active-rfcs/0000-sfc-script-setup.md#with-typescript

Thanks, But not just a question. Now is strange to define a default value for props. finally, I only define a default CONST and add a lot of redundancy logic in