Skip to content

Commit d29fbbc

Browse files
committed
fix: add TypeScript declarations for @lwrjs/api module
- Added TypeScript declaration file in src/types/lwrjs-api.d.ts - Added declaration file in node_modules/@types/lwrjs__api/index.d.ts for runtime resolution - Updated tsconfig.json to include .d.ts files - Exports specific functions used in site.ts: expDev, setupDev, SitesLocalDevOptions - Resolves TS7016 module resolution error in CI and local environments
1 parent f755c17 commit d29fbbc

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/types/lwrjs-api.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2025, salesforce.com, inc.
3+
* All rights reserved.
4+
* Licensed under the BSD 3-Clause license.
5+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
8+
declare module '@lwrjs/api' {
9+
export type LwrConfig = Record<string, unknown>;
10+
export type LwrServer = Record<string, unknown>;
11+
export type SitesLocalDevOptions = Record<string, unknown>;
12+
13+
export function createServer(config: LwrConfig): LwrServer;
14+
export function expDev(options: SitesLocalDevOptions): Promise<void>;
15+
export function setupDev(options: SitesLocalDevOptions): Promise<void>;
16+
17+
// Export everything else as unknown to maintain compatibility
18+
export const api: unknown;
19+
export default api;
20+
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"skipLibCheck": true,
77
"baseUrl": "."
88
},
9-
"include": ["./src/**/*.ts"]
9+
"include": ["./src/**/*.ts", "./src/**/*.d.ts"]
1010
}

0 commit comments

Comments
 (0)