Skip to content

Commit

Permalink
fix(export): types only export for index file (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolink authored Dec 13, 2020
1 parent f275792 commit cb5d8df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cf-definitions-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default class CFDefinitionsBuilder {

files.forEach(fileName => {
indexFile.addExportDeclaration({
isTypeOnly: true,
namedExports: [moduleName(fileName), moduleFieldsName(fileName)],
moduleSpecifier: `./${fileName}`,
});
Expand Down
2 changes: 1 addition & 1 deletion test/cf-definitions-builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ describe('A Contentful definitions builder', () => {

const result1 = await fs.readFile(path.resolve(fixturesPath, 'index.ts'));
expect('\n' + result1.toString()).to.equal(stripIndent(`
export { TypeSysId, TypeSysIdFields } from "./TypeSysId";
export type { TypeSysId, TypeSysIdFields } from "./TypeSysId";
`));
});

Expand Down

0 comments on commit cb5d8df

Please sign in to comment.