Compare commits

...

1 Commits

Author SHA1 Message Date
David Sanders
09df62b103 chore: prefer 'as const' syntax 2024-10-14 17:03:25 -07:00
3 changed files with 5 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ const { URL: NodeURL } = __non_webpack_require__('internal/url');
// Separate asar package's path from full path.
const splitPath = (archivePathOrBuffer: string | Buffer | URL) => {
// Shortcut for disabled asar.
if (isAsarDisabled()) return { isAsar: <const>false };
if (isAsarDisabled()) return { isAsar: false } as const;
// Check for a bad argument type.
let archivePath = archivePathOrBuffer;
@@ -74,8 +74,8 @@ const splitPath = (archivePathOrBuffer: string | Buffer | URL) => {
if (archivePath instanceof NodeURL) {
archivePath = getValidatedPath(archivePath);
}
if (typeof archivePath !== 'string') return { isAsar: <const>false };
if (!asarRe.test(archivePath)) return { isAsar: <const>false };
if (typeof archivePath !== 'string') return { isAsar: false } as const;
if (!asarRe.test(archivePath)) return { isAsar: false } as const;
return asar.splitPath(path.normalize(archivePath));
};

View File

@@ -467,7 +467,7 @@ async function getMergedTrops (commit: Commit, pool: Pool) {
backportRegex
);
return match
? <const>[match[1], new GHKey(ghKey.owner, ghKey.repo, parseInt(match[2]))]
? [match[1], new GHKey(ghKey.owner, ghKey.repo, parseInt(match[2]))] as const
: null;
};

View File

@@ -101,7 +101,7 @@ describe('session module', () => {
expect(c.value).to.equal(value);
});
for (const sameSite of <const>['unspecified', 'no_restriction', 'lax', 'strict']) {
for (const sameSite of ['unspecified', 'no_restriction', 'lax', 'strict'] as const) {
it(`sets cookies with samesite=${sameSite}`, async () => {
const { cookies } = session.defaultSession;
const value = 'hithere';