Skip to content

typescript - LiteralUnion not working #5951

@ghost

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.0-beta.2

Environment

Mac M1, vue 3, typescript": "^4.7.4", VS code

Reproduction photo

  • color will not suggection it's say string

Screen Shot 2022-09-07 at 10 49 45 AM

- after replace to use new LiteralUnion in es/_util/type.d.ts it will working again

https://github.com/vueComponent/ant-design-vue/blob/main/components/_util/type.ts#L17

Screen Shot 2022-09-07 at 10 52 12 AM

  • after change it's will suggect agian (reload your IDE)

Screen Shot 2022-09-07 at 10 51 53 AM

Steps to reproduce

typescript": "^4.7.4" antd LiteralUnion not working

export declare type LiteralUnion<T extends U, U> = T | (U & {});

// after replace to use new LiteralUnion in es/_util/type.d.ts it will working again
https://github.com/vueComponent/ant-design-vue/blob/main/components/_util/type.ts#L17

type Primitive =
| null
| undefined
| string
| number
| boolean
| symbol
| bigint


export type LiteralUnion<LiteralType, BaseType extends Primitive> =
| LiteralType
| (BaseType & Record<never, never>)

What is expected?

It' should have suggection type e.g color = 'primary' but it say string

What is actually happening?

LiteralUnion not working don't know the reason yet

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