Skip to content

dogfood: @webjsdev/core subpath exports lack a types condition (no types for /directives, /task, etc.) #389

Description

@vivek7405

Problem

Importing from @webjsdev/core SUBPATHS has no type information, so import { watch } from '@webjsdev/core/directives' or import { Task } from '@webjsdev/core/task' red-squiggles (no types found) under nodenext/bundler module resolution. Surfaced alongside #388 while dogfooding the VSCode extension (#382), but is a DISTINCT root cause from the index.d.ts drift.

Root cause

In packages/core/package.json, several subpath entries in the exports map have NO types condition and resolve only to a built .js bundle with no sibling .d.ts:

Subpath Resolves to Sibling .d.ts?
./directives ./dist/webjs-core-browser.js none (src/directives.d.ts missing)
./context ./dist/webjs-core-browser.js none
./task ./dist/webjs-core-browser.js none
./client-router ./dist/webjs-core-browser.js none
./lazy-loader ./dist/webjs-core-lazy-loader.js none
./testing ./dist/webjs-core-testing.js none

AGENTS.md tells agents to import from these subpaths (e.g. watch from @webjsdev/core/directives, Task / TaskStatus from @webjsdev/core/task, context from @webjsdev/core/context), so this is on the documented happy path.

Fix

  • Add a types condition to each subpath exports entry pointing at a real .d.ts (authored src/<name>.d.ts, mirroring how ./component already points at src/component.d.ts).
  • Author the missing src/{directives,context,task,client-router,lazy-loader,testing}.d.ts declarations.
  • Extend the dogfood: package .d.ts files drift from runtime exports (many import type errors) #388 guard idea: a test that every exports subpath with a JS target also has a resolvable types target (counterfactual: removing one fails it).

Acceptance criteria

  • import { watch } from '@webjsdev/core/directives', import { Task, TaskStatus } from '@webjsdev/core/task', and the other documented subpath imports type-check clean.
  • Every JS-bearing exports subpath has a types condition resolving to a real .d.ts.
  • A test enforces the subpath types invariant (counterfactual proven).
  • Docs unaffected (the subpaths were always documented).

Related: #388 (the index.d.ts named-export drift).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions