Code Monkey home page Code Monkey logo

Comments (5)

HerringtonDarkholme avatar HerringtonDarkholme commented on June 7, 2024

Thanks for reporting! I will take a look.

from av-ts.

HerringtonDarkholme avatar HerringtonDarkholme commented on June 7, 2024

Strangely I cannot reproduce. Could you provide an example with ComponentsWithMixin and ComponentsWithoutMixin definition?

from av-ts.

thorning avatar thorning commented on June 7, 2024

The following compiles in ts 2.3.2 but not in 2.4.2 for me:

@Trait class TestTrait extends Vue {}

@Component({
  name : 'mixin-component'
})
class MixinComponent extends Mixin(TestTrait) {

}

@Component({
  name : 'depend-on-mixin-component',
  components : {
    MixinComponent
  }
})
class DependOnMixin extends Vue {

}

I get the following error in 2.4.2:

Argument of type '{ name: string; components: { MixinComponent: typeof MixinComponent; }; }' is not assignable to parameter of type 'ComponentOptions<Vue> | undefined'.
  Type '{ name: string; components: { MixinComponent: typeof MixinComponent; }; }' is not assignable to type 'ComponentOptions<Vue>'.
    Types of property 'components' are incompatible.
      Type '{ MixinComponent: typeof MixinComponent; }' is not assignable to type '{ [key: string]: typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | AsyncComponent...'.
        Type '{ MixinComponent: typeof MixinComponent; }' is not assignable to type '{ [key: string]: typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | AsyncComponent...'.
          Property 'MixinComponent' is incompatible with index signature.
            Type 'typeof MixinComponent' is not assignable to type 'typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | AsyncComponent'.
              Type 'typeof MixinComponent' is not assignable to type 'AsyncComponent'.
                Type 'typeof MixinComponent' provides no match for the signature '(resolve: (component: Component) => void, reject: (reason?: any) => void): void | typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | Promise<Component>'.

I tried looking though the definitions, but not quite sure what the problem is. It might be that VClass, which the Mixin function returns, does not extend Vue or ComponentOption? I cant quite wrap my head around it though.

from av-ts.

HerringtonDarkholme avatar HerringtonDarkholme commented on June 7, 2024

It seems quite hard to fix. The problem is mixin pattern cannot handle static property well...

from av-ts.

HerringtonDarkholme avatar HerringtonDarkholme commented on June 7, 2024

I come up with a method to add static method! Released as 0.9.1.

from av-ts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.