Skip to content

Commit

Permalink
fix: remove unnecessary types file from generated index
Browse files Browse the repository at this point in the history
  • Loading branch information
alharris-at committed Nov 22, 2021
1 parent 74f4614 commit f7565a0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { ReactRenderConfig } from '..';
import { ReactIndexStudioTemplateRenderer } from '../react-index-studio-template-renderer';

class ReactIndexStudioTemplateRendererWithExposedRenderConfig extends ReactIndexStudioTemplateRenderer {
getRenderConfig(): ReactRenderConfig {
return this.renderConfig;
}
}

describe('ReactIndexStudioTemplateRenderer', () => {
describe('constructor', () => {
test('overrides renderTypeDeclarations to false', () => {
const renderer = new ReactIndexStudioTemplateRendererWithExposedRenderConfig([], {
renderTypeDeclarations: true,
});
expect(renderer.getRenderConfig().renderTypeDeclarations).toBeFalsy();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class ReactIndexStudioTemplateRenderer extends StudioTemplateRenderer<
this.renderConfig = {
...defaultRenderConfig,
...renderConfig,
renderTypeDeclarations: false, // Never render type declarations for index.js|ts file.
};
this.fileName = `index.${scriptKindToFileExtensionNonReact(this.renderConfig.script)}`;
}
Expand Down

0 comments on commit f7565a0

Please sign in to comment.