Closed PitchforkAssistant closed 1 week ago
Made the requested change now that I was finally able to compile and notice the issue with the undefined check.
And I agree that the README could use better instructions for compiling specific packages like the public-api
one.
I ended up clearing everything except that package, changing out several of its dependencies for valid @next versions (packages like the matching @devvit/shared-types
and @devvit/protos
are not included with this repo), and copying the src/devvit/internals/semanticColors.ts
and src/types/icons.js
files from an already published version because generating them requires dependencies that aren't public (@reddit/faceplate-ui
).
Possibly fixes #108
๐ธ TL;DR
Allows WikiPage.#revisionAuthor to be undefined, as that is a possibility for some wiki pages.
๐ Details
Removes
assertNonNull(data.revisionBy?.data, 'Wiki page author details are missing');
from the WikiPage constructor and sets#revisionAuthor
to be of typeUser | undefined
depending on whetherdata.revisionBy
exists. Updatesget revisionAuthor()
andtoJSON()
to reflect the type change.It's worth noting that
revisionBy
is already marked as potentially undefined in theWikiPage
interface from@devvit/protos
.revisionId
andrevisionDate
are not marked that way, but would also be returned asnull
by the Data API in this same edge case of a wiki page with no revision history.๐งช Testing Steps / Validation
Untested, as I am unable to set up the environment to produce a successful build even with no changes. TypeScript language server doesn't show any new errors though. Additionally, there are no existing tests for WikiPage found in
/packages/public-api/src/apis/reddit/tests
.โ Checks
Unable to test, see above.
WikiPage.ts
file.