Open mkarajohn opened 6 months ago
Hi there. A couple of requests:
/dist
? I'll generate those when we do the next release
- Can you undo the changes to
/dist
? I'll generate those when we do the next release
Done
- Do you know how to add a type checking task to the npm?
We will have to install typescript as a developer dependency. We won't be writing the code in TS nor we'll be shipping compiled code (...unless you want to write the source in TS and ship compiled code?); it's only needed in order to parse our JSDoc definitions and validate the code against them. If you are ok with that, we can add something like this
"typecheck": "tsc --allowJs --checkJs --noEmit --target ES5 src/*.js"
What do you say?
For the record I am currently giving it a 2nd pass to clean up type errors that showed up with TS setup locally. I will be pushing a second commit during the day.
Ok, the prevalent issue is that there are lots of cases such as .nextSibling
, which return either Node
or null
values and these values are then passed to functions that expect Element
arguments (e.g. the function isSoftMatch
clearly expects Element
s (or null
) as arguments, since internally it tries to access properties that only exist in Element
s and not Node
s, but the function itself is called with the return value of something.nextSibling
, for example, which can either be Node
or null
)
Maybe properties such as .nextElementSibling
should be used instead?
Ok, a few comments:
function(a: number) { a = 'foo'; }
--> a
is still considered a number, so the reassignment will throw a type error). You should prefer declaring new variables instead of reassigning argumentsmergeDefaults
, createMorphContext
and insertSiblings
). set/getAttribute
instead of direct assignment.Node
/Element
issue. (possible solutions: allow for both in functions that now only accept one of them and make extra runtime checks to ensure type correctness, or, in places where you expect Element
but pass Node
use the corresponding attributes for getting an Element
value (e.g. .nextElementSibling
etc)I am here to help with whatever you decide to do
@1cg
Not trying to be a nuisance, but is this still under consideration or should I stop thinking about it? 😂
It's fine if this won't go any further, I just need to have some kind of closure 😅
Hi dimiris no I am still interested in this. I have been mainly focused on htmx 2 though. Will try to get to this next week.
Sent from Proton Mail for iOS
On Fri, Dec 29, 2023 at 8:59 PM, Dimitris Karagiannis @.***(mailto:On Fri, Dec 29, 2023 at 8:59 PM, Dimitris Karagiannis < wrote:
@.***(https://github.com/1cg)
Not trying to be a nuisance, but is this still under consideration or should I stop thinking about it? 😂
It's fine if this won't go any further, I just need to have some kind of closure 😅
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Still interested in this, but htmx 2.0 is taking up all my time. I promise I will get to it by the end of the month though.
No worries no worries, since you said you have not abandoned it the first time around that was all I wanted to know; don't feel like you have to explain yourself, I realize HTMX 2 is the bigger thing right now :P
On Mon, Jan 8, 2024, 22:51 1cg @.***> wrote:
Still interested in this, but htmx 2.0 is taking up all my time. I promise I will get to it by the end of the month though.
— Reply to this email directly, view it on GitHub https://github.com/bigskysoftware/idiomorph/pull/25#issuecomment-1881801844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA45DKQTXUMLWTNYAR7NTRTYNRL63AVCNFSM6AAAAABA5ZYUVOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRHAYDCOBUGQ . You are receiving this because you authored the thread.Message ID: @.***>
going to look at this tonight
Added types to every function and config object, to the best of my ability.
One thing that surfaced from this process is that in some places functions expect arguments as
Element
, but the functions themselves may have been called in places where the arguments that are passed are of the broaderNode
type, notElement
.This could lead to bugs theoretically (big if true!); maybe it should get checked, I have placed some
TODO
s in there to get the reader's attention.I also ran
gen-modules
>dist
>uglify
but I am not sure if I should have or if they are generated automatically.