MemberJunction / MemberJunction/MJ

@memberjunction/server ships "types": "./src/index.ts" — consumers type-check MJ sources under their own compiler options

Open Beginner friendly
#3,113 0 comments 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
TSQL
Stars
29
Forks
6
Avg merge
2d 1h
Merged PRs (30d)
323

Description

## Summary

`@memberjunction/server@5.43.0` (and current `next`) publishes:

```json
"main": "./dist/index.js",
"types": "./src/index.ts"
```

It is the only package in the MJ ecosystem (we surveyed all 244 in our pnpm store) whose `types` points at TypeScript **sources** rather than built declarations. The published tarball's `dist/` already ships complete declarations — 130 `.d.ts` files including `generated.d.ts` — so the fix is one line:

```json
"types": "./dist/index.d.ts"
```

## Why it matters for consumers

When `types` points at `.ts` sources, any consumer running `tsc` type-checks MJ's sources under the **consumer's** `compilerOptions`. Neither of the usual defenses applies:

- `skipLibCheck: true` only skips `.d.ts` files — these are `.ts`.
- `exclude: ["node_modules"]` only trims the include glob — files reached via import resolution are still checked.

In our repo (strict, `exactOptionalPropertyTypes`, no `experimentalDecorators` at the root), this produced **50,176 errors from node_modules** on every `pnpm type-check` — 46,306 of them in `src/generated/generated.ts` alone, dominated by decorator config errors (TS1240 ×20,574, TS1206 ×11,214) and `strictPropertyInitialization` (TS2564 ×8,090) in code we don't own. It also means every consumer's tsserver loads and checks MJ server sources in the IDE.

## Verification

Flipping the one line in the installed package drops our repo from 52,941 errors to a residual that contains **zero** node_modules errors — the server's imports of other MJ packages all resolve through those packages' own `dist` declarations, so nothing else needs to change.

We're carrying this as a pnpm patch in the meantime and will drop it when a release includes the fix.

Contributor guide

Open the contributing guide

Research direction

Inspect the published @memberjunction/server package metadata and its dist declarations, especially the existing main and types entries. Confirm that the package exposes the declaration entry point, then run the repository's pnpm type-check and verify that node_modules no longer contributes the reported errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.