Closed Cafe137 closed 2 years ago
👋 Hi! Could you try installing the beta release, and check if that issue persists? You can install it via npm as described here.
npm i @fluffy-spoon/substitute@beta
EDIT: I meant TS 4.8 not 3.8 😅
Hey 👋
Yes, the issue is present in the substitute@beta.1
see the issues:
node_modules/@fluffy-spoon/substitute/dist/src/Substitute.d.ts:15:35 - error TS2344: Type 'T' does not satisfy the constraint 'Object'.
15 static for<T>(): SubstituteOf<T>;
~
node_modules/@fluffy-spoon/substitute/dist/src/Substitute.d.ts:15:16
15 static for<T>(): SubstituteOf<T>;
~
This type parameter might need an `extends Object` constraint.
node_modules/@fluffy-spoon/substitute/dist/src/Substitute.d.ts:16:46 - error TS2344: Type 'unknown' does not satisfy the constraint 'Object'.
16 static disableFor<T extends SubstituteOf<unknown> & Instantiable<Substitute>>(substituteProxy: T): DisabledSubstituteObject<T>;
~~~~~~~
Found 2 errors in the same file, starting at: node_modules/@fluffy-spoon/substitute/dist/src/Substitute.d.ts:15
The first issue solves my PR #242 (I have tested that locally), but the second issue about the disableFor()
I am not sure how to really solve.
I would suggest you to bump to TS 3.8 and test it yourself ;-)
Hmm ok, I see where the confusion comes from. This issue mentions typescript 4.8.3
, but your PR targets version 3.8
.
I see this as two separate issues:
4.8
works with the beta release -> Solved?I will leave this issue open for a few days, but to me it seems this issue is solved by using the beta
Oh fuck, sorry my bad 🙈 I am targeting TS 4.8
(pretty much the latest), not sure how I mixed it up for 3.8
. I will fix it in the PR title.
Sorry about the confusion, but then no using beta does not solves this issue ;-)
No worries! Hmm I'm unable to reproduce it locally. What's your tsconfig? I think this might be related to the strict modes
Hi @Cafe137 and @AuHau, could you try with the latest beta relase? https://www.npmjs.com/package/@fluffy-spoon/substitute/v/2.0.0-beta.2 I think the issue you were facing was caused because the library wasn't able to transpile in typescript strict mode. Now it does
I think this issue should have been fixed here https://github.com/ffMathy/FluffySpoon.JavaScript.Testing.Faking/pull/244 Please reopen in case the problems persist
Describe the bug
I am on version
1.208.0
using Typescript4.8.3
and runningtsc
gives the following type error:node_modules/@fluffy-spoon/substitute/dist/src/Substitute.d.ts Line 6: