Комментарии:
looks interesting, gotta give it a try
ОтветитьThis looks amazing!!
Ответитьi think it should be official feature. ternary ops is disgusting.
ОтветитьAmazing
ОтветитьCan you also fix the “this ridiculously complex and nested object type has some minute error but I’m only going to show you the first 100 lines of the error which doesn’t show the actual error because it’s 200 lines”? Because that would be great 😂
I get the “type <entire western literature with a typo> is not assignable to type <entire western literature>” but it’s just a wall of truncated red text 😢
God bless you for this man, would really aid my creativity when solving type problems
ОтветитьThat’s why I like zig meta programming
Ответитьwow, this seems really nice!
ОтветитьIn my case I don't use nesting like that, but instead I use () brackets to group types. While it does not change anything meaningful, it make it readable to me.
ОтветитьSome illogical step, that you define type as function, but use it still with angle brackets, not like function call.
ОтветитьWhat a hidden gem this is. Thank you
Ответитьcan this do anything other than if/else branches? variables maybe? switch statements would be cool.
because avoiding ternaries by writing a whole meta language just feels like working around the problem instead of fixing it.
i understand where youre coming from, ternaries were never meant to be chained a lot, so the problem lies mostly in the language design of typescript itself, tho in that position i would try to reconsider how i write my types, or better yet choose a language with a reasonable type system that wasnt hacked on another without one
tbf i have the luck of not being a typescript developer, im sure there are valid reasons youre masochistic
Definitely a great spell for ts wizard 😂
ОтветитьYou are a god, thank a lot!
ОтветитьAmazing thing, a suggestion though, can we write it like this instead:
functype Find<T> {}
That way it’s more consistant between the definition and the call, and is compatible with the current TypeScript syntax.
And can you make a proposal to the TypeScript team to add such a feature to the TypeScript itself?
I was excited when I thought this might enable passing generics without arguments to other generic to use within. I don't really like the if/else chain either, but to each their own there.
I think TypeScript would benefit from a terse pattern matching syntax.
This is the kind of type that Microsoft should have created in the beginning, but never did. I like TS but always hated that it can only use nested ternaries to express switch cases. At least with this type buddy, the syntax looks so much cleaner. Thank you so much! 😊
Ответитьreally like the idea. maybe typescript team can add a new keyword "typefunction" which dev can write a type function.
typefunction Maybe(T) { if (T extends string) return string; else return T; }
I would even pay to have this plugin for Webstorm too.
ОтветитьThe outfile should probably be .ts not .d.ts
ОтветитьThis is actually a great idea. Will try the web version after my holiday vacation.
Question: would it be possible for you to abstract the "infer" syntax with something of your own? Like "getInnerType" or something. I see people always having problems with the "extends" in combination with "infer" all the time.
I've been wondering every time why there's no way to write types like normal functions, and here it is!
ОтветитьBuds, can we all agree thats should work in .ts files without any IDE extensions? I'm thinking of a babel plugin to do it in the background, what do u think?
ОтветитьGreat plugin! Thanks.
Would it be possible to remove de "tb" from the .d.ts filename?
Like typebuddy.tb -> typebuddy.d.ts
This is a minor and stupid nitpick, so feel free to ignore it, but can you add a space between the word "if" and the opening parenthesis? It's triggering my OCD lol
ОтветитьI think creating d.ts is not ideal since d.ts types are global
Ответитьjust a note. writing Find<Inner> or StringOrNever<A> in typebuddy is somehow wrong. you should use normal brackets like Find(Inner) or StringOrNever(A) especially since that is how you define the type itself in your first line. makes no sense to use () there and then use <> later on. bad syntax.
beside of that good idea
Wow This is an instant must have plugin. Thank you very much!
Ответитьawesome!! 👍👍
ОтветитьJust casually drops the plugin of the year like it's nothing. 😂
ОтветитьAfter watching your last video (which was my first video that i watched from you), i was like "finally, someone who knows more typescript than me". I have read and learned alot from tanners code before. Will binge watch all your videos and read your repos now. Yay. Thanks so much for such content man. The more i watch you, the more i think "man this guy is incredible". This is a simple parser to implement but such a genius idea
ОтветитьThank you for cool & useful thing! It would be interesting to see how you made the plugin for the ide, and how you compile of types to functions and back. It would be interesting to see a video about this. Thanks again!
Ответитьgood
ОтветитьBro, your channel is gold mine <3
ОтветитьNeat
Ответитьgreat work. one thing which would be neat is incorporating various loops or mapped types as for loops or some fluent mapping function on a union of string literals (e.g. keyof T)
Ответить