Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Type 'PromiseConstructor' is not assignable to type 'Constructor' #376

Closed
wucdbm opened this issue Mar 30, 2021 · 0 comments
Closed

Type 'PromiseConstructor' is not assignable to type 'Constructor' #376

wucdbm opened this issue Mar 30, 2021 · 0 comments

Comments

@wucdbm
Copy link

wucdbm commented Mar 30, 2021

Describe the bug

Affects version 10.0.0-rc.3 with vue 3

Type 'PromiseConstructor' is not assignable to type 'Constructor'.
Type 'PromiseConstructor' is not assignable to type 'new () => any'.

@Options({
    emits: ['open', 'close', 'blur', 'update:modelValue', 'left-icon'],
})
export default class FzField extends Vue {
    @Prop(Object) modelValue!: ModelObject | null
    @Prop([Array, Promise, Function]) options!: ModelObjectOptions

PS Just for clarification

type ModelObject = Record<string, unknown>
type ModelObjectsOrPromise = ModelObject[] | Promise<ModelObject[]>
type ModelObjectCallback = (query: string) => ModelObjectsOrPromise
type ModelObjectOptions = ModelObjectsOrPromise | ModelObjectCallback

To Reproduce

  1. Create a vue 3 project with class component and prop decorator
        "vue": "^3.0.9",
        "vue-class-component": "^8.0.0-rc.1",
        "vue-property-decorator": "10.0.0-rc.3",
  1. Create a vue component
  2. Add a prop with @Prop annotation and and types array, one of the types must be Promise
  3. Error Type 'PromiseConstructor' is not assignable to type 'Constructor'.

Expected behavior
Expecting no errors, should be able to use Promise constructor as a type for a property

Screenshots
https://imgur.com/a/F6Su1z5

Desktop (please complete the following information):

  • OS: Linux
  • Browser Chrome
  • Version 89

Additional context

It has been working fine with 9.0.0 and vue 3 since vue alpha versions. I just noticed there were newer versions and tried 10 rc3, this is the only issue I've experienced so far. I'll ts-ignore that for the time being. No harm other than complaining about the type.

PS Thanks a bunch for supporting a great library!

@wucdbm wucdbm closed this as completed Jan 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant