26 Replies
I don't remember if this does it: https://github.com/yoavbls/pretty-ts-errors
It doesn't
Aw shame
Tbf I would appreciate if this would make list that can be opened to see more of the types, like in file explorer
Yeah, I honestly would love a huge expanded view of types because I'm often dealing with pretty gnarly types in my dayjob. bonus points for "Go to definition" of mapped types, too.
Basically something that treats the type-level language as a first-class concept and allows exploration the same as the value-level language
What annoys me the most is that in errors it doesn't truncate the types so much leading to huge error messages that are barely readable
Yeah, I wish it did like:
So basically hide the verbose types using their names until you get to the final line and then show what primitive is conflicting.
I know it can't do that all the time due to structural typing (there might be multiple names for the same structure), but maybe in certain circumstances it could do that.
Somebody give me the option to click on that
... 12 more ...
!
I find it that often in errors something like
would be enough. Just get to the element that collides. You can detect what it is!
I don't need to know the whole type of type1AThe problem is that the language server only really knows how to work with plain text.
Wait, what would you want it to show in this case?
Currently the error would be
or something like this
if there's more fields it would be lot longer, but I find it that more often than not I only would need at the fields that causes issues OR the parent fields/types
I'm curious because normally you wouldn't actually have
Type1
and Type2
It would just be:
Error I just created
if it was nested in an object, you can look up one level and see what property of the object it is referring to (if it's not hidden!), but I'm exactly complaining that it doesn't (and in a lot of cases can't) show you the type name.
right: no type names. Just the type literals.
In a perfect world, I would want that to be:
oh yeah, it should be possible, no?
It's just relocation of strings
Nope, because TypeScript uses structural typing so it might be any type that has that shape.
I think the language server could do a better job with this, though.
If you use classes/functions, you get names here, but that's not idiomatic for just raw data.
ah fair, anyway gtg I need to clean up house and work a little more lol
I'm still a newbie to TS, I only started actually working in february, and most of my time is spent fighting with react 😐
ahh, well, welcome, glad to have you here with us.
I personally hate how the types can be broader than their type (back to the structural typing point), but then again I guess things like
Object.keys
works around this by not assuming the type is exactly of T
That sounds weird, what I mean is that shape of an object can be broader than T
And because of that we get things like Object.keys
just return string[]
instead of keyof T
Yep. Structural typing (and to some extent subtyping) is why TypeScript is popular, but it's a big hinderance to the type-system itself in my experience.
I wish it was a keyword or something :(
Thanks, I'm glad I heard about zod from Matt Pocock. Watched video "ah cool", then started working "okay, what this package was?"
I like working, since it doesn't allow for "do and forget", but man, do I hate my current project. Somehow there was nothing, but also hhad to work with some weird code because for some reason I'm the only frontend dev. It needs serious teardown and refactor, but no time to do it.
previous dev used redux store for caching for some reason, and created weird promise helper, that is awful to use
Welcome to industry 😬 ! Unless you're the first engineer being hired at a startup, or a principal starting a new greenfield project at an established company, you'll always be walking into something with a lot of technical debt and compromises and outdated practices and failed experiements.
And if you are the first engineer, or a principal starting a greenfield, you'll be the one generating the tech debt and weird failed experiments for some other poor dev to scratch their head about.
I mean the project was started by someone 3/4 levels (as in school years) lower than me, around 6 months beforehand. AFAIK they also are junior and were without mid/senior to overlook what they are doing. This whole project is a mess organization wise. Everything somehow works. And I somehow know enough about what I did to proceed, but before we enter into next stage there's a need to rethink and rework most of the stuff. Starting with database structure, endpoints and what exactly is needed. I started to redo some endpoints with tanstack query to fix caching issues, but every time I encounter then problems with data structure 🙂
and i'm 100% NOT writing things the "proper" way. I notice some code I wrote especially at the start that is full of holes, but no time to fix
I just need 1 more person so we can do both fixing and introducing new stuff at similar pace
and not one or the other