Giter Site home page Giter Site logo

Support Typescript 5 about ts-auto-mock HOT 10 CLOSED

hoi4 avatar hoi4 commented on June 18, 2024
Support Typescript 5

from ts-auto-mock.

Comments (10)

uittorio avatar uittorio commented on June 18, 2024 2

Hey! I can give it a try! Hopefully is not too difficult!

from ts-auto-mock.

uittorio avatar uittorio commented on June 18, 2024 2

Oh thats a shame! Thank you for reporting it! Do you mind just copy this into a new bug?

I will have a look!

from ts-auto-mock.

uittorio avatar uittorio commented on June 18, 2024 1

good news, I can run it locally with ts-patch in beta!! I need to fix a couple of things but it's promising!

from ts-auto-mock.

uittorio avatar uittorio commented on June 18, 2024 1

I will probably merge it tomorrow morning and then it will be automatically released

from ts-auto-mock.

hoi4 avatar hoi4 commented on June 18, 2024 1

@uittorio Most of our tests work like a charm with the new version. Thank you the amazingly quick release.

There seems to be a problem with nested mocks though 🤔

Example:

const summaryImages: SummaryImage[] = createMockList<SummaryImage>(2, (index: number) => {
  return {
    id: index,
    source: `source-for-id-${index}`,
  };
});

const test = createMock<Summary>({ summaryImages })

The error is Type 'SummaryImage[]' is not assignable to type 'PartialObjectDeep<SummaryImage[]>.

from ts-auto-mock.

uittorio avatar uittorio commented on June 18, 2024

Hey @hoi4 . It looks like we are not in a great position.

Ts-auto-mock depends on libraries like ts-patch or ttypescript.

ttypescript is not maintaned and ts-patch has a beta version out that I need to try!

ts-patch -> nonara/ts-patch#93

typescript notes -> microsoft/TypeScript#52953

I will update this issue!

from ts-auto-mock.

hoi4 avatar hoi4 commented on June 18, 2024

I also already migrated our tests to use ts-patch instead of ttypescript and tried the beta of ts-patch (by overwriting the peer dependency typescript of ts-auto-mock to use 5.0.4). Unfortunately, ts-auto-mock reported that it is not setup correctly. (The same setup works fine with typescript 4.9.5)

from ts-auto-mock.

uittorio avatar uittorio commented on June 18, 2024

This is the PR, just need to see if it works in different version of node and also add some documentation about ttypescript that is deprecated for typescript 5 and ts-patch that is in beta. #1466

from ts-auto-mock.

uittorio avatar uittorio commented on June 18, 2024

You should try ts-auto-mock version 3.7. It has just been released.

I was expecting a new version released (4.0) considering the breaking change but for some reason semantic release didnt work and it bump to a version minor instead of major!

from ts-auto-mock.

hoi4 avatar hoi4 commented on June 18, 2024

You are a legend! 🚀 I will try it tomorrow 👍🏻

from ts-auto-mock.

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.