Conversation
Three fields in the Header declaration disagree with the object decode() builds (headers.js:139-155): - type omits four values toType() can return — pax-header, pax-global-header, gnu-long-link-path, gnu-long-path — and is declared non-nullable although toType() returns null for any unrecognised typeflag (headers.js:186-201). - linkname is declared string, but decode() assigns null when byte 157 is zero (headers.js:104). - byteOffset is absent from the declaration, although decode() always sets it (headers.js:140) and extract.js:153 updates it per entry.
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fields in the
Headerinterface added by #179 disagree with the objectheaders.decode()builds. All three are verifiable fromheaders.jsalone.typeomits four values and cannot benulltoType()(headers.js:186-201) returns four more —'pax-header'(72),'pax-global-header'(55),'gnu-long-link-path'(27),'gnu-long-path'(28, 30) — and falls through toreturn nullfor any unrecognised typeflag.decode()assigns the result unguarded at:147.Consequences today:
entry.type === 'pax-header'is a compile error (TS2367, "this comparison appears to be unintentional"), and anullguard ontypeis flagged as statically dead when it is the only thing standing between a caller and an unrecognised entry.linknamecannot benulllinkname: stringheaders.js:104—const linkname = buf[157] === 0 ? null : decodeStr(...). Every entry without a link target haslinkname === null, which is the common case.byteOffsetis missing entirelydecode()always sets it (headers.js:140), andextract.js:153updates it per entry (this._header.byteOffset = this._buffer.shifted). It is absent from the declaration, so reading it is a compile error on a property that always exists.Types-only, no runtime change. Widening
typeandlinknamealso widensHeaderArgumentforpack.entry(), which is consistent with the runtime:toTypeflag()(headers.js:203-224) already returns0for anything it does not recognise,nullincluded.Context
Noticed downstream. 3.2.1's bundled declarations shadow
@types/tar-stream, which had modelled all 13typevalues plusnull, andlinknameasstring | null— so for these fields the DefinitelyTyped package was the more accurate of the two, and adopting the bundled types is currently a narrowing. This PR closes that gap so the bundled declarations are strictly the better source.