mobx-vue | Vue bindings for MobX | State Container library

 by   mobxjs TypeScript Version: 2.2.0 License: MIT

kandi X-RAY | mobx-vue Summary

kandi X-RAY | mobx-vue Summary

mobx-vue is a TypeScript library typically used in User Interface, State Container, Vue, Axios applications. mobx-vue has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Vue bindings for MobX
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              mobx-vue has a low active ecosystem.
              It has 444 star(s) with 22 fork(s). There are 10 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 16 open issues and 30 have been closed. On average issues are closed in 40 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of mobx-vue is 2.2.0

            kandi-Quality Quality

              mobx-vue has no bugs reported.

            kandi-Security Security

              mobx-vue has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              mobx-vue is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              mobx-vue releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mobx-vue
            Get all kandi verified functions for this library.

            mobx-vue Key Features

            No Key Features are available at this moment for mobx-vue.

            mobx-vue Examples and Code Snippets

            No Code Snippets are available at this moment for mobx-vue.

            Community Discussions

            QUESTION

            Typescript error: The 'this' context of type ... is not assignable to method's 'this' of type
            Asked 2020-Dec-11 at 12:12

            I'm currently debugging some libraries' code and for the life of me don't understand a specific error.

            Here is a simplified example of the code I'm debugging:

            ...

            ANSWER

            Answered 2020-Dec-11 at 11:14

            You have found an inconsistency in the way TypeScript deals with the interaction of Function and union types.

            What the compiler does

            When call is called, the compiler knows test1Fnc is either:

            1. a JavaScript Function object of some unknown signature, or
            2. a JavaScript Function object which is called on a string (ie it has a string as its this argument) and returns an object.

            The compiler then asks if the call is valid for each of those types.

            When it asks if the call is valid for type 1, it concludes that the call is not because test1Fnc may not be callable on a string.

            Why this is odd

            This is odd because this is contrary to regular TypeScript behaviour for Function objects, where it normally allows any kind of function call. To see that such calls are allowed, temporarily change the initial type declaration to type Test1Type = object and the error disappears.

            This happens because two things about how Function types are processed by the compiler are true:

            1. Any kind of call of a function on them is permissible, but
            2. They are not assignable to a function with specified arguments.

            When the compiler knows test1Fnc is a Function only (as when the type declaration is changed), it works because of rule 1. But when the union type is involved, it first tries to assign the union type to the given signature of the call type. That assignment fails because of rule 2 before rule 1 has had a chance to override it.

            Why this is not how the compiler should behave

            You can see this is not the intended behaviour because if Test1Type is defined to be just either one of those two types (provided the modification explained in the next section is made) then the compiler does not give any errors. This is not right: if a path through the program is valid for either type in a union type, then the program should be valid with the union type.

            Yet the type is wrong anyway

            As another observation, even if test1Fnc is type 2 from above, it would not not be callable with the call function set out. The given call function expects a this value of string and also one regular argument of type string, yet type 2 from above is just a this value of type string with no regular arguments. The compiler is not showing this error at present, but if you change the initial type declaration to type Test1Type = ((this: V) => object) then you will see a different error produced. In turn this is eliminated by changing the line to type Test1Type = ((this: V, arg: V) => object).

            Suggestions: redefine, cast, report and don't use unions

            To deal with this, you might consider one or more of the following:

            1. Redefine Test1Type = object | ((this: V, arg: V) => object), which appears to be what the code is expecting. This doesn't really change the type given it could still be any object, but it does express the code's intention better
            2. Then to clear the error, if you can cast the type of test1Fnc within the if block to the expected type: res = (test1Fnc as (this: string, arg: string) => object).call(x,x). If you are unable to make a change like this, you might have to give up on any type safety and go for type Test1Type = object
            3. You might like to report this an issue on the TypeScript GitHub. I'm not sure it's a priority for them as the use of Function objects for typing are probably not encouraged, and
            4. I'd discourage the use of this union type anyhow. It's so general it's not really achieving type safety in any case. It's not clear how much control you have over the code, and what other values Test1Type might need to be, but if you can make wider changes, it would be preferable to write it as a union of more explicit types so the compiler could choose between them, or more rigorously set up a class hierarchy in full OOP style.

            Source https://stackoverflow.com/questions/65245161

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install mobx-vue

            You can download it from GitHub.

            Support

            | package | mobx v6 | mobx v2/v3/v4/v5 | vue2 | vue3 | | ------ | ------- | ---------------- | ---- | ---- | | mobx-vue | >= v2.1.0 | * (exclude v2.1.0) | * | - | | mobx-vue-lite | * | - | - | * |. * means all and - means none.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i mobx-vue

          • CLONE
          • HTTPS

            https://github.com/mobxjs/mobx-vue.git

          • CLI

            gh repo clone mobxjs/mobx-vue

          • sshUrl

            git@github.com:mobxjs/mobx-vue.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular State Container Libraries

            redux

            by reduxjs

            vuex

            by vuejs

            mobx

            by mobxjs

            redux-saga

            by redux-saga

            mpvue

            by Meituan-Dianping

            Try Top Libraries by mobxjs

            mobx

            by mobxjsTypeScript

            mobx-state-tree

            by mobxjsTypeScript

            mobx-react

            by mobxjsTypeScript

            mobx-react-lite

            by mobxjsTypeScript

            mobx-react-devtools

            by mobxjsJavaScript