Subscribe on changes!

[@vue/compiler-sfc] Failed to resolve index type into finite keys

avatar
Sep 1st 2023

Vue version

lastest

Link to minimal reproduction

Steps to reproduce

<script setup lang="ts">
import type { InputNumberProps } from 'naive-ui';
const { componentProps } = defineProps<InputNumberProps>();
const slots = useSlots();
</script>
[vite] Internal server error: [@vue/compiler-sfc] Failed to resolve index type into finite keys

E:/projects/stp-web/node_modules/naive-ui/es/_utils/naive/extract-public-props.d.ts        
3  |  type themePropKeys = keyof typeof useTheme.props;
4  |  type RemoveReadonly<T> = {
5  |      -readonly [key in keyof T]: T[key];
   |                        ^^^^^^^
6  |  };
7  |  export type ExtractPublicPropTypes<T> = Omit<Partial<RemoveReadonly<ExtractPropTypes<T>>>, Exclude<themePropKeys, 'themeOverrides'> | Extract<keyof T, `internal${string}`>>; 

What is expected?

Fix this error, otherwise Support imported types in SFC macros seems pointless

What is actually happening?

[@vue/compiler-sfc] Failed to resolve index type into finite keys #9111

System Info

window

Any additional comments?

No response

avatar
Sep 1st 2023

It is not supported native-ui yet. use /@vue-ignore/ to skip it.

avatar
Sep 1st 2023

Should this be handled by vue or naiveUI? @edison1105

avatar
Sep 1st 2023
<script setup lang="ts">
import type { InputNumberProps } from 'naive-ui';
const { componentProps } = defineProps<InputNumberProps>();
const slots = useSlots();
</script>

@edison1105 Where should I set /@vue-ignore/

avatar
Sep 1st 2023

Duplicate of #8266

See #8286 (comment) #8286 (comment)

Does this mean that v3.3 still cannot use external props?

avatar
Sep 1st 2023

It's not a yes or no question. Please read the two comments I provided. I believe they have explained it in enough detail.

avatar
Sep 1st 2023

Where should I set /@vue-ignore/

<script setup lang="ts">
import type { InputNumberProps } from 'naive-ui';
Where should I set /@vue-ignore/
const { componentProps } = defineProps<InputNumberProps>();
const slots = useSlots();
</script>

@sxzz Thank you for your help. I have already read it, but I set /@vue-ignore/, it will still report an error