Skip to content

Commit 00b5c9b

Browse files
Copilotfregante
andcommitted
Move broken selector from exists() to $() for clearer validation
- Reverted isLoggedIn selector back to valid: 'body.logged-in' - Broke getLoggedInUser selector: 'meta[name="user-login"] >' - TypeScript now fails with: "Property 'getAttribute' does not exist on type 'never'" - This clearly demonstrates strict validation is working Co-authored-by: fregante <[email protected]>
1 parent 4bc0567 commit 00b5c9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const is500 = (): boolean => document.title === 'Server Error · GitHub'
3535

3636
export const isPasswordConfirmation = (): boolean => document.title === 'Confirm password' || document.title === 'Confirm access';
3737

38-
export const isLoggedIn = (): boolean => exists('body.logged-in >');
38+
export const isLoggedIn = (): boolean => exists('body.logged-in');
3939

4040
export const isBlame = (url: URL | HTMLAnchorElement | Location = location): boolean => Boolean(getRepo(url)?.path.startsWith('blame/'));
4141
TEST: addTests('isBlame', [
@@ -875,7 +875,7 @@ TEST: addTests('isNewRepoTemplate', [
875875
]);
876876

877877
/** Get the logged-in user’s username */
878-
const getLoggedInUser = (): string | undefined => $('meta[name="user-login"]')?.getAttribute('content') ?? undefined;
878+
const getLoggedInUser = (): string | undefined => $('meta[name="user-login"] >')?.getAttribute('content') ?? undefined;
879879

880880
/** Drop all redundant slashes */
881881
const getCleanPathname = (url: URL | HTMLAnchorElement | Location = location): string => url.pathname.replaceAll(/\/\/+/g, '/').replace(/\/$/, '').slice(1);

0 commit comments

Comments
 (0)