Ts-toolbelt: O.Writable broken in 6.13.24

Created on 24 Jul 2020  路  7Comments  路  Source: millsp/ts-toolbelt

interface IM { n: number; }

function test<M extends IM>(m: M) {
  const fn1 = m.n; // OK
  const wm = m as O.Writable<M>;
  const fn2 = wm.n; // Property 'n' does not exist on type 'Writable<M, string | number | symbol, "flat">'.ts(2339)
}

used to work ok in 6.10.16 (and probably later).

bug

Most helpful comment

I should be the one thanking you! After all you put a lot of time and effort into this for free 馃憤 Thanks again!

All 7 comments

Arf, sorry about this again. My tests pass but the metadata is somehow lost when working with generics. Now I'm wondering how this affects the library as a whole. Thanks for reporting. Working on it.

No worries, always happy to help :)

Amazing, thank you. The fix will be out in a few moments.

I'm afraid this is happening again in the latest version :(

You know what, I did not write tests for this, I wrote them for another utility Patch and Merge which I thought were the upstream problem... I'm so sorry, this is very unprofessional. I'm writing the same tests for all the other ones, I don't want to cause you problems anymore. Again, sorry!

Hey @xaviergonz. Thank you so much for this! You helped me uncover a very old, suspected bug that caused metadata loss because of (way) too much type distribution. I've added tests for all the concerned tools, I'm doing all I can to break this curse :laughing:.

I'm very sorry for the disturbance I caused. I hope you are still enjoying using ts-toolbelt and that you will stick to it in the future. Thanks that you helped me solve a hidden bug that was plaguing all of the most important tools of this library.

Cheers!

_Fix will be out in 3 minutes_

I should be the one thanking you! After all you put a lot of time and effort into this for free 馃憤 Thanks again!

Was this page helpful?
0 / 5 - 0 ratings