-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Unknown keys on instance should not be typed as any
when instantiating from Base.defaults()
or Base.plugin()
#31
Comments
Can you drop the generic contraint Without it works: |
Thanks a lot for looking into it!
It came from here: With your changes, javascript-plugin-architecture-with-typescript-definitions/test.ts Lines 53 to 68 in 3e0da09
TS Playground to showcase the problem |
Oh, I thought that TS would be smart enough to understand that Casting return values with |
Thanks, that works with my tests so far. I'll ship it in @octokit, we'll see how it goes! |
…ven when used with plugins and defaults) (#312) thanks to @Andarist thanks to @Andarist gr2m/javascript-plugin-architecture-with-typescript-definitions#31
Ping me if you encounter any problems - quite frankly this API was somewhat hard to grok at first for me and I was unsure what are exact constraints that you want to achieve so it's hard for me to assess if this will truly "just work" for everything you want to achieve. I'm not entirely sure why this was the problem but I think this was because you were using mixin types/feature (I was not aware that TS supported this~ up to this point) and that using those triggered some different code path in TS that resulted in this. My "fix" just works around this by not using those mixin semantics and just implementing "mixin" by hand at the type-level. |
🎉 This issue has been resolved in version 2.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Example
The problems are these two lines from the resulting
.d.ts
filejavascript-plugin-architecture-with-typescript-definitions/index.d.ts
Line 22 in 3e0da09
javascript-plugin-architecture-with-typescript-definitions/index.d.ts
Line 28 in 3e0da09
I don't quite understand whey they are coming from, and how I can change them to at least
[x: string]: unknown
.Any idea?
Here is a playground with the full source code
The text was updated successfully, but these errors were encountered: