question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mixins props is marked as required by typescript even tho I defined it as optional

See original GitHub issue
import PropTypes from 'vue-strict-prop';

export const textXsCenterMixin = {
  props: {
    textXsCenter: PropTypes(Boolean).optional,
  },
};

const Flex = componentFactory.mixin(textXsCenterMixin).create({ //...

image

Typescript complain Property 'textXsCenter' is missing in type

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
wonderful-pandacommented, Sep 10, 2018

@chanlito If you want to use props in mixin, you must use tsx.component with mixin declaration.

import * as tsx from "vue-tsx-support";

export const textXsCenterMixin = tsx.component({
  props: {
    textXsCenter: PropTypes(Boolean).optional,
  },
});

const Flex = componentFactory.mixin(textXsCenterMixin).create({ //...
0reactions
chanlitocommented, Sep 11, 2018

@wonderful-panda That works! Cheers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

New way to define props and emits options #447 - GitHub
I think we need to provide a way to define props options as same as basic Vue even if we can omit them....
Read more >
Prop is marked as required in component, but its value is ...
In console, I am getting an error : Warning: Failed prop type: The prop item is marked as required in Details , but...
Read more >
Documentation - Mixins - TypeScript
Using the mixin pattern with TypeScript. ... To get started, we'll need a class which will have the mixins applied on top of:...
Read more >
Documentation - Do's and Don'ts - TypeScript
Optional Parameters in Callbacks ... This has a very specific meaning: the done callback might be invoked with 1 argument or might be...
Read more >
Documentation - TypeScript 4.0
To deepen the connection between parameter lists and tuple types, the syntax for rest elements and optional elements mirrors the syntax for parameter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found