-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix alias bug #302
Fix alias bug #302
Conversation
const { mode: aliasMode } = parseAlias(token.$value[i]); | ||
token.partialAliasOf[i] = aliasOfID; | ||
const { id: aliasID, mode: aliasMode } = parseAlias(token.$value[i]); | ||
token.partialAliasOf[i] = aliasID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reaallllly subtle bug: when using partialAliasOf
, we want the immediate alias, not the resolved value. This can lead to incorrect values because you may set up different modes / different triggers for intermediary aliases.
Deploying terrazzo with Cloudflare Pages
|
bcd6373
to
71d900c
Compare
} | ||
const aliasOfID = resolveAlias(token.$value[i][property], { tokens, logger, filename, node, src }); | ||
const { mode: aliasMode } = parseAlias(token.$value[i][property]); | ||
const { id: aliasID, mode: aliasMode } = parseAlias(token.$value[i][property]); | ||
token.partialAliasOf[i][property] = aliasID; // also keep the shallow alias here, too! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: I am actually a really big fan of having this parser stay in .js
. At a microscopic level, sure, there are a few papercuts. But on a macro level, dealing with “incorrect” data structures and defensive programming are SOOOOO much easier in JS than TS (you basically have to turn types off anyway, because it thinks something can’t be a certain type, unless you type everything as unknown
, at which point… why are you using TS?)
71d900c
to
7365f95
Compare
Changes
Fixes a bug in the aliasing. #299 was close, trying to catch the bug, but didn’t quite get it.
How to Review