Conversation
|
(I just reran the windows-latest flake) |
@kriskowal , I defer to you on this. I'll just say I hope we can adopt that precedent as a general rule ;) |
packages/marshal/src/marshal.js
Outdated
|
|
||
| /** | ||
| * @param {Remotable | Promise} passable | ||
| * @param {import('@endo/pass-style').PassableCap} passable |
There was a problem hiding this comment.
Now that we have @import, and since you're changing these lines anyway, I prefer to gather these all the top into @import declarations.
| const extant = valMap.get(index); | ||
| if (extant) { |
There was a problem hiding this comment.
Yeah, when the value is necessarily truthy, this pattern is better. (Likewise extant !== undefined when the value is necessarily not undefined.) Only problem in general is the refactoring hazard if a collection's use changes to include falsy or undefined values. Not worried about that here.
| * in reverse order by passing a reversed rank comparison function. | ||
| * | ||
| * @param {Iterable<Passable>} passables | ||
| * @template {Passable} T |
There was a problem hiding this comment.
What do you think of
| * @template {Passable} T | |
| * @template {Passable} [T=Passable] |
for all or most of these? It offloads the use site from needing to say <Passable> when that's all it would say anyway. I've been doing essentially this elsewhere and been happy with the results.
There was a problem hiding this comment.
that makes sense for parameterized typedefs, but here the template slot's type is constrained by the first argument. Giving a default doesn't help.
| apply(objectHasOwnProperty, obj, [prop]); | ||
| harden(hasOwnPropertyOf); | ||
|
|
||
| /** @type {(val) => val is {}} */ |
There was a problem hiding this comment.
I've never seen this inline before. Nice.
| harden(isRemotable); | ||
|
|
||
| /** | ||
| * @callback AssertArray |
There was a problem hiding this comment.
Yeah, I don't remember why I have these separate named @callable types. Good riddance, thanks.
|
|
||
| /** | ||
| * @param {Passable} val | ||
| * @param {Key} val |
There was a problem hiding this comment.
Shouldn't this be
| * @param {Key} val | |
| /** | |
| * @param {any} val | |
| * @returns {val is Key} | |
| */ |
?
There was a problem hiding this comment.
good one!
I've added a test showing how the is Key gets used. I don't think we want to losen the param because if it's not even Passable then that would be good static feedback. If you want to loosen it, please do in a separate PR across all the similar cases.
| // @ts-expect-error M.any missing parens | ||
| M.arrayOf(M.any); |
|
Did we stop requiring conventional commits? |
718b502 to
c9cdff1
Compare
My mistake. All your commits are fine. I was misled by the title, as my habit is to have the title also follow this convention (and usually be identical to the first commit). |
78ef12b to
8462132
Compare
kriskowal
left a comment
There was a problem hiding this comment.
I’m substantially excited about this change. I would like to break out a PR for the change to the release and build process so that it can suffer a revert separately if necessary. I’d also like to replace temporary markers XXX and FIXME with something but it doesn’t have to be tedious. It could be a single explanation or link to a tracking issue with a bunch of dittos or daggers for the repeated cases.
resolutions farther out, there’s not much reason to spare the major version bump.
packages/base64/package.json
Outdated
| "scripts": { | ||
| "build": "exit 0", | ||
| "build:types": "tsc --build tsconfig.build.json", | ||
| "prepack": "tsc --build tsconfig.build.json", |
There was a problem hiding this comment.
I would like to capture this process change in a separate PR.
packages/captp/src/captp.js
Outdated
| * @type {import('@endo/marshal').ConvertSlotToVal<import('./types.js').CapTPSlot>} | ||
| * @type {import('@endo/marshal').ConvertValToSlot<import('./types.js').CapTPSlot>} | ||
| */ | ||
| // @ts-expect-error intentional hack |
There was a problem hiding this comment.
What’s the nature of the hack?
There was a problem hiding this comment.
bad comment. the type was wrong so I just removed it
packages/captp/src/captp.js
Outdated
| epoch, | ||
| questionID, | ||
| target, | ||
| // @ts-expect-error XXX |
| @@ -1,3 +1,6 @@ | |||
| export * from './src/exo-makers.js'; | |||
|
|
|||
| // eslint-disable-next-line import/export -- ESLint not aware of type exports in types.d.ts | |||
There was a problem hiding this comment.
That’s unfortunate and might explain some of my experience.
There was a problem hiding this comment.
yeah. I think we should consider disabling the rule. I think it has more false positives and fewer true positives than TS
| @@ -0,0 +1,2 @@ | |||
| /** @file Empty twin for .d.ts */ | |||
packages/marshal/src/marshal.js
Outdated
| const reviveFromSmallcaps = makeDecodeFromSmallcaps({ | ||
| // @ts-expect-error FIXME | ||
| decodeRemotableFromSmallcaps, | ||
| // @ts-expect-error FIXME |
packages/marshal/src/rankOrder.js
Outdated
| if (left < right) { | ||
| return -1; | ||
| } else { | ||
| // @ts-expect-error FIXME narrowed |
There was a problem hiding this comment.
👆 Is the intention to address all FIXMEs before landing? These could be links to an issue, otherwise.
There was a problem hiding this comment.
not before landing. maybe never. I've taken out the FIXME
packages/marshal/src/rankOrder.js
Outdated
| } | ||
| case 'symbol': { | ||
| return comparator( | ||
| // @ts-expect-error FIXME narrowed |
There was a problem hiding this comment.
I would not object to ditto if these stick around.
| // @ts-expect-error FIXME narrowed | |
| // @ts-expect-error ditto, type narrowed |
| } | ||
| for (const helper of passStyleHelpers) { | ||
| if (helper.canBeValid(inner)) { | ||
| // @ts-expect-error XXX |
| // rank order. | ||
| // Because the invariants above apply to the elements of the array, | ||
| // they apply to the array as a whole. | ||
| // @ts-expect-error FIXME narrowed |
There was a problem hiding this comment.
👆 I’m fine with a link and dittos if these are intended to commit. (but don’t like FIXME because I like FIXME and XXX to be used as markers for work that needs to be ironed out before a merge.
|
Also, please add |
|
I had to rebase to resolve merge conflicts created by #2256 I squashed the fixups and rolled in other changes requested by review |
f22e68c to
9444daf
Compare
fixes a problem with .js files having .d.ts twin
kriskowal
left a comment
There was a problem hiding this comment.
You may want to look over the remaining XXX and TODO cases.
9444daf to
1ae099d
Compare
closes: #1488
Description
Reattempting:
Again:
Passablea generic type instead ofany.passStyleOfto return the actual style.Keyin terms ofPassableany'sSecurity Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
Better types are better documentation.
Testing Considerations
Upgrade Considerations
These changes may cause type errors downstream. I don't think we should call those breaking change à la semver because they don't affect the runtime.