Skip to content

fix(build): add declaration maps for better editor navigation#124

Open
Kyzgor wants to merge 1 commit intopermitio:mainfrom
Kyzgor:fix/77-add-declaration-maps
Open

fix(build): add declaration maps for better editor navigation#124
Kyzgor wants to merge 1 commit intopermitio:mainfrom
Kyzgor:fix/77-add-declaration-maps

Conversation

@Kyzgor
Copy link

@Kyzgor Kyzgor commented Mar 8, 2026

Summary

Enable TypeScript declaration maps (declarationMap: true) to fix "Go to Definition" navigation in editors like VS Code.

Problem

As reported in #77, using "Go to Definition" on SDK methods (e.g., permit.api.roles.create) navigates to compiled JavaScript without type information, rather than to the typed declaration files. This makes it impossible to inspect parameter types like RoleCreate or return types like RoleRead through normal editor navigation.

Solution

Added declarationMap: true to tsconfig.json. This generates .d.ts.map files alongside the existing .d.ts declarations during the tsc --emitDeclarationOnly build step. These map files enable editors to properly resolve "Go to Definition" and "Go to Type Definition" to the typed declarations.

Changes

  • tsconfig.json — Added declarationMap: true compiler option

Testing

  • yarn lint passes
  • yarn build:types generates .d.ts.map files alongside .d.ts files (verified: build/index.d.ts.map, build/api/roles.d.ts.map, etc.)
  • Declaration maps are automatically included in the published package via the existing build entry in the files field

Backwards Compatibility

No breaking changes. Declaration maps are additive — they only improve editor DX for SDK consumers. Consumers that don't use TypeScript or don't rely on "Go to Definition" are unaffected.

Note: This PR addresses the declaration map portion of #77. The tsconfig target update (es2017ES2022) mentioned in the issue is a separate change that would affect the minimum supported Node version and should be discussed separately.

Checklist

  • yarn lint passes
  • yarn build:types succeeds with .d.ts.map output
  • No changes to src/openapi/ (auto-generated)

Refs #77

Enable `declarationMap` in tsconfig.json to generate `.d.ts.map` files
alongside type declarations. This fixes "Go to Definition" in editors
like VS Code, which currently navigates to compiled JS without type
information instead of the typed declaration files.

Refs permitio#77
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.

1 participant