This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 380
Cannot use @Prop() Decorator #250
Comments
@smholsen This PR solves the issue... I hope that @kaorun343 checks it soon |
I am not using a modified Vue type though, what is the supported type, and
how can I make sure that I am on the supported version?
…On Mon, 26 Aug 2019, 17:07 Aram Sabatés, ***@***.***> wrote:
@smholsen <https://github.com/smholsen> This PR solves the issue...
#246 <#246>
I hope that @kaorun343 <https://github.com/kaorun343> checks it soon
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#250?email_source=notifications&email_token=AANEIATXI3DJ7BG6LS6WYATQGPWS5A5CNFSM4IPQJTBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5EVBAQ#issuecomment-524898434>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANEIAWAAO77SFZXHEGXMN3QGPWS5ANCNFSM4IPQJTBA>
.
|
You can use the 'props' property in the 'Component' decorator.
Like:
@component({
props: (whatever config based on official Vue documentation)
});
This should solve the problem for now. The issue of that PR is that there
are some libraries of Vue (even official) that extend the base type and the
decorators don't inherit from them but from the 'core', so then you get
that error that you're missing something.
Let me know if it works for you :)
…On Mon, Aug 26, 2019, 17:33 Simon Olsen ***@***.***> wrote:
I am not using a modified Vue type though, what is the supported type, and
how can I make sure that I am on the supported version?
On Mon, 26 Aug 2019, 17:07 Aram Sabatés, ***@***.***> wrote:
> @smholsen <https://github.com/smholsen> This PR solves the issue...
> #246 <#246>
>
> I hope that @kaorun343 <https://github.com/kaorun343> checks it soon
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <
#250?email_source=notifications&email_token=AANEIATXI3DJ7BG6LS6WYATQGPWS5A5CNFSM4IPQJTBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5EVBAQ#issuecomment-524898434
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AANEIAWAAO77SFZXHEGXMN3QGPWS5ANCNFSM4IPQJTBA
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#250?email_source=notifications&email_token=ALAVF44WKRMKB5RRO6XO3NDQGPZT7A5CNFSM4IPQJTBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5EXQRA#issuecomment-524908612>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALAVF452BMSLBKSZTC2QXJDQGPZT7ANCNFSM4IPQJTBA>
.
|
Thanks! That probably works, but for IDE support it's not ideal, as my IDE does not recognize the props defined in the @component deocrator in the class. E.g. See this example;
Is there anyway to work around this? Would it work fine to define the prop in the class like this for example?
Is there any problems with this approach? Is any other solution better? |
I haven't found anything better than that.
As you have done, just define your property with the "!" and move it
forward.
I don't think any IDE get the definition from the Components properties as
the types don't use them...
What I am doing is putting it like that and add a TODO for when it's
fixed...
…On Mon, Aug 26, 2019, 17:56 Simon Olsen ***@***.***> wrote:
Thanks!
That probably works, but for IDE support it's not ideal, as my IDE does
not recognize the props defined in the @component
<https://github.com/component> deocrator in the class.
E.g. See this example;
@component({
name: "Additional",
props: {
notes: String,
}
})
export default class Additional extends Vue {
doSomething() {
// this.notes is not recognized by the IDE
this.notes = '';
}
}
Is there anyway to work around this? Would it work fine to define the prop
in the class like this for example?
@component({
name: "Additional",
props: {
notes: String,
}
})
export default class Additional extends Vue {
notes!: string;
doSomething() {
// Now this.notes is recognized by the IDE
this.notes = '';
}
}
Is there any problems with this approach? Is any other solution better?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#250?email_source=notifications&email_token=ALAVF4ZRG23SJFODA6MKTU3QGP4JZA5CNFSM4IPQJTBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5EZVDQ#issuecomment-524917390>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALAVF43R5ZHHWIQUQMARK2DQGP4JZANCNFSM4IPQJTBA>
.
|
Please check the latest version, |
Hey, this is how I usually get around this problem:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I am in the midst of trying to rewrite my hobby project from js to ts, and I am currently trying to use the @prop decorator in my component using the code below;
But I get the following error in my IDE;
Do you have any suggestions or ideas on what is going wrong here?
Any tips on where to start debugging this issue?
The text was updated successfully, but these errors were encountered: