Skip to content

Commit ba15cb4

Browse files
authored
fix: generated type declarations for output files (#70)
1 parent ee87966 commit ba15cb4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/components/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function writeComponentsDocumentation({ outDir, ...options }: WriteOption
4545
fs.writeFileSync(
4646
pathe.join(outDir, 'index.d.ts'),
4747
`import { ComponentDefinition } from './interfaces';
48-
const definitions: Record<string, ComponentDefinition>;
48+
declare const definitions: Record<string, ComponentDefinition>;
4949
export default definitions;
5050
`
5151
);

test/components/writer.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import { expect, test } from 'vitest';
4+
import { execSync } from 'node:child_process';
45
import fs from 'node:fs';
56
import pathe from 'pathe';
67
import { getTemporaryDir } from './test-helpers';
@@ -22,4 +23,5 @@ test('should write documentation files into the outDir', async () => {
2223
expect(definitions).toEqual({
2324
simple: expect.objectContaining({ name: 'Simple', dashCaseName: 'simple' }),
2425
});
26+
expect(() => execSync('tsc index.d.ts', { cwd: outDir, stdio: 'inherit' })).not.toThrow();
2527
});

0 commit comments

Comments
 (0)