382 Members
A superset of JavaScript that compiles to clean JavaScript output. https://www.typescriptlang.org/3 Servers

Load older messages

Timestamp Message
16 Sep 2019
21:21:45@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)And it restored my build time. Had to also comment why it was done =/
21:29:15@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) microsoft/TypeScript#33451
21:29:21@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)More reasons why function overload is broken
21:29:56@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) (edited) ... function overload is ... => ... function overloading is ...
23:12:41@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter) I’d be leery of that any... if you accidentally use the wrong types in the future it won’t catch it...
23:14:12@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) Yeah, that's why I have a massive block of comment telling me to be careful
23:14:28@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) It's only used in an implementation context. So, the any type won't propagate to users.
23:15:04@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) And that as any was because of overloaded generic functions again... -___-
23:15:27@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) I have this function that has two overloads.
The overload depends on whether obj.x is undefined or not
23:15:40@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)So, I split it into two different generic functions
23:15:46@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) mapInitial(), mapCompose()
23:15:51@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)Those two compile fine
23:16:26@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) Then, I wanted to combine them into one function,
function map (obj, otherThing) {
  if (obj.x == undefined) {
    return mapInitial(obj, otherThing);
  } else {
    return mapCompose(obj, otherThing);
23:16:40@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)So, 5 lines of code, for function body
23:17:04@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) This caused tsc to crash.
Okay. So, I added explicit type annotations everywhere.
30+ seconds. Wtf
23:17:22@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) So, I said "fuck it".
And removed the type annotations and used as any all over the place.
23:17:36@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) Since I had already proven to myself that the thing compiles without as any
23:19:32@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) basically,
function map (obj, otherThing) : any {
  if (obj.x == undefined) {
    return mapInitial<any, any>(obj as any, otherThing as any);
  } else {
    return mapCompose<any, any>(obj as any, otherThing as any);
23:19:51@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)Compile time went back down to 6-8 seconds
23:19:56@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)Huuuuuge improvement
23:21:10@gitter_fatcerberus:matrix.orgBruce Pascoe (Gitter)The type checker REALLY doesn’t like your code, it seems.
23:21:45@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)It is okay with it from a consuming perspective
23:22:01@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)I can compile 452 of my test files in 24s
23:22:10@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)But it hates the implementation perspective lol
23:22:28@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter)Part of the 452 files includes stress testing, like chaining a function/method 100+ times
23:23:21@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) I also broke the ReturnType<> type
23:23:23@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) microsoft/TypeScript#33457
23:23:34@gitter_anyhowstep:matrix.orgAnyhowStep (Gitter) Related to my map() function
17 Sep 2019
00:54:14@gitter_bradtaniguchi:matrix.orgBrad (Gitter) Hmm is using Pick on an enum a thing? Or should I be doing something else?
00:55:11@gitter_bradtaniguchi:matrix.orgBrad (Gitter) bah I'm stupid, I can just do Enum.One | Enum.Two

There are no newer messages yet.

Back to Room List