Code Monkey home page Code Monkey logo

Comments (7)

skarab42 avatar skarab42 commented on June 3, 2024 1

@jasonkuhrt I really need to add more documentation to this project. Ideally I would like to use tsc directly but unfortunately I haven't found a way to do it and I don't think it's possible (but you never know until someone does). However, it is possible to make a plugin for vscode that could report the errors in the IDE (not in the near future). In any case, thank you for reporting.

from vite-plugin-vitest-typescript-assert.

skarab42 avatar skarab42 commented on June 3, 2024

@jasonkuhrt This is the expected behaviour, expectType is doing a strict type equality comparison and in this case the input parameter in your create function is not a simple Record but an intersection of several Zod objects. In this case, if your goal is not to test the type equality but its assignability you should use expectAssignable.

from vite-plugin-vitest-typescript-assert.

skarab42 avatar skarab42 commented on June 3, 2024

@jasonkuhrt Maybe you want to test the tssert API which is a bit more flexible and less ambiguous. Both APIs can be used at the same time, which allows for testing and gradual transition.

from vite-plugin-vitest-typescript-assert.

jasonkuhrt avatar jasonkuhrt commented on June 3, 2024

@skarab42 Do you agree it is incorrect that the IDE and Vitest output disagree though? When I type check the codebase with tsc I also see no error (agrees with IDE).

from vite-plugin-vitest-typescript-assert.

skarab42 avatar skarab42 commented on June 3, 2024

@jasonkuhrt I don't see any errors in the IDE except the warning that says to avoid using unbound methods.

from vite-plugin-vitest-typescript-assert.

skarab42 avatar skarab42 commented on June 3, 2024

Sorry I misunderstood the question. It's normal not to have the error in the IDE nor with tsd. If you look at the implementation of the expectType function you see that it does strictly nothing and accepts all types/values (this is not really true). When the plugin encounters this function then it calls a custom version of the TS compiler to perform the type tests.

from vite-plugin-vitest-typescript-assert.

jasonkuhrt avatar jasonkuhrt commented on June 3, 2024

@skarab42 Ahhhh. Ok did not expect that. Do you prefer to work this way? Does it have to be this way? Is the idea to centralize all the "feedback" into one consistent place?

Not sure what I think yet. But I think I'd want to see the error show up outside of Vitess.

from vite-plugin-vitest-typescript-assert.

Related Issues (3)

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.