Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Typescript 5 #1465

Closed
hoi4 opened this issue May 10, 2023 · 10 comments
Closed

Support Typescript 5 #1465

hoi4 opened this issue May 10, 2023 · 10 comments

Comments

@hoi4
Copy link

hoi4 commented May 10, 2023

Hi, @uittorio

Thank you for your invaluable work on this library!

Are there plans to support Typescript 5?

Thank you!

@uittorio
Copy link
Member

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

@uittorio
Copy link
Member

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!

@hoi4
Copy link
Author

hoi4 commented May 10, 2023

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)

@uittorio
Copy link
Member

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

@uittorio
Copy link
Member

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

@uittorio
Copy link
Member

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

@uittorio
Copy link
Member

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!

@hoi4
Copy link
Author

hoi4 commented May 11, 2023

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

@hoi4
Copy link
Author

hoi4 commented May 12, 2023

@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[]>.

@uittorio
Copy link
Member

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

I will have a look!

@hoi4 hoi4 closed this as completed May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants