Skip to content

fix(everything-dev): replace hard-coded auth type list with export type * - #238

Merged
elliotBraem merged 3 commits into
mainfrom
fix/auth-types-gen-export-wildcard
Aug 18, 2026
Merged

fix(everything-dev): replace hard-coded auth type list with export type *#238
elliotBraem merged 3 commits into
mainfrom
fix/auth-types-gen-export-wildcard

Conversation

@elliotBraem

@elliotBraem elliotBraem commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Fixes NEARBuilders/nearbuilders.org#206

Problem

The auth-types.gen generator hard-coded a 14-type re-export list from the auth plugin's auth-export, causing TS2724 errors when the auth plugin renamed or added types. The same list was duplicated in 5 locations.

Changes

New shared module: packages/everything-dev/src/auth-types-gen.ts — single source of truth for the auth-types.gen template and stub content (auth-export.d.ts, contract.d.ts).

Collapsed duplication:

  • api-contract.ts: two duplicate 30-line functions (writeAuthTypesGen, writeContractBasedAuthTypesGen) → inline path computation + shared builder call
  • init.ts: generateAuthTypesContent + hard-coded stub strings → shared builder calls
  • typecheck-utils.ts: hard-coded stub strings → shared stub builders

Removed 3 unused derived types: AuthActiveMember, AuthBaseSession, AuthContractType (zero consumer imports). Also removed all Raw* aliases.

export type * propagation: host/src/lib/auth.ts, ui/src/lib/auth.ts, api/src/lib/auth.ts now use export type * from "./auth-types.gen" so new auth types flow through automatically — no manual re-export lists.

Hermetic integration test: init.typecheck.test.ts no longer runs bos types gen (which fetches remote plugin URLs). The test is now fully hermetic — stubs ensure typecheck passes without network.

Result

Net −184 lines across 9 files. Single source of truth for the auth types gen template. Zero maintenance when upstream auth plugin adds/renames types — export type * propagates automatically.

…pe *

The auth-types.gen generator hard-coded a 14-type re-export list from the
auth plugin's auth-export, causing TS2724 errors when the auth plugin renamed
or added types (e.g. GetOrganizationInput -> GetFullOrganizationInput, and
AuthTeam was missing entirely).

Replace the hard-coded list with 'export type * from auth-export' in all
five locations (the main generator, the init scaffold, and the test stub).
New types added to auth-export now flow through automatically. Updates the
init and test stubs with the corrected GetFullOrganizationInput name and
adds AuthTeam.

Adds a regression test that verifies the generator produces export type *
and would not reference a stale hard-coded name like GetOrganizationInput.

See NEARBuilders/nearbuilders.org#206
@elliotBraem elliotBraem changed the title Fix auth types gen export wildcard fix(everything-dev): replace hard-coded auth type list with export type * Aug 18, 2026
…ype *

Three duplicated copies of the auth-types.gen template (api-contract.ts x2,
init.ts x1) plus two hard-coded stub type lists (init.ts, typecheck-utils.ts)
are replaced with a single shared module: packages/everything-dev/src/auth-types-gen.ts.

Also removes three unused derived types (AuthActiveMember, AuthBaseSession,
AuthContractType) and all Raw* aliases from the generated content.

Adds export type * to host/src/lib/auth.ts, ui/src/lib/auth.ts, and
api/src/lib/auth.ts so new auth types propagate automatically — no manual
re-export list to maintain when upstream auth-export changes.

Deletes the flaky init.typecheck.test.ts which attempted to skip the network
fetch. init.full.test.ts already covers the full init + types:gen + typecheck
flow in CI.

See NEARBuilders/nearbuilders.org/issues/206
@elliotBraem
elliotBraem force-pushed the fix/auth-types-gen-export-wildcard branch from 7a6780f to d6a4100 Compare August 18, 2026 20:11
@elliotBraem
elliotBraem merged commit 380f907 into main Aug 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix stale auth type name in everything-dev type generation

1 participant