-
-
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
Use the type system to verify version again #62
base: main
Are you sure you want to change the base?
Conversation
PRing this, but it should be noted that I can't reproduce the |
Yeah, I fully reverted, and my example works fine with the old one. I don't think you need to I'll go take a look at the code from Lume. |
Hmmm. There's a CI failure, but I didn't touch the actual code, just the types. I'll look at it later. |
Huh. I can reproduce locally, but the diff clearly shows that I didn't change anything. |
Figured it out 😀 |
Thanks a lot for looking into this ! |
Hey, so I just finished some more investigation and this turns out to be more of a docs issue :) Basically, typescript assigns types sequentially and assumes everything is mutable... so it doesn't know how it'll be used ahead of time. Therefore, it assigns the type string b/c it doesn't know the object is an xml_document until later, when it's used. All of my code called it directly, so TS had the context, but the Lume code assigns it to a variable, setting the type in stone. I'm looking into ways to make TS recognize it otherwise, b/c I think I've fixed this before somehow. Maybe just by inlining it? I figure that's the best option, but I'm looking at some casting options as well. |
Ok, a few options: a) Don't merge this, lose typesafety (I'm usually a purist, but this clearly trips some people up, so maybe?) I'd probably just go with c. |
Oh, whatever you choose, you won't need the generics, just maybe a partial_xml_document type. Honestly, it doesn't save a keystroke and only saves a character, so I wouldn't do anything there. Just revert 78ed4ac and call it a day (with some docs changes). |
One thought I just had—does libs follow SemVer? What's the public API? Presumably this is a major? It feels rather mundane, but I guess it is technically breaking. Yeah, I'm very much a purist. Oh well :) Edit: I now see that libs does follow SemVer. |
559f980
to
c78f0aa
Compare
c78f0aa
to
2b0af54
Compare
2b0af54
to
57df0dc
Compare
Ok, should be good to go! |
57df0dc
to
39c776d
Compare
I think it'd be best to go with a mixed solution of a/c:
The reasoning behind is, in addition to avoiding releasing a new major, is that while I want to enforce strict typing in the internal code of I'm already quite annoyed by explicity typing |
39c776d
to
67eb8d0
Compare
Ok, I'll do that. I just finish rebasing this a bunch, so I should be ready to edit it again. The stack should now be #66 (so that I don't ruin formatting), #63 (so that the prose wrapping is included), #62 (this one).
Yeah. I get slow-types (TS 5.5 is releasing with it built in soon), but it's weird. I don't plan on turning it on, none of my projects are slow enough for it to be beneficial. |
67eb8d0
to
27cdcd5
Compare
I hope that's right. I noticed that it wasn't consistent.
Otherwise, deno fmt messes up the styling in the readmes.
The READMEs now break on sentences. See also: <https://sembr.org/>
27cdcd5
to
502e93d
Compare
Depends on: #63.
Reverts: 78ed4ac