diff --git a/code/lib/cli/src/generators/REACT/index.ts b/code/lib/cli/src/generators/REACT/index.ts index 0bf8bb0ba23b..c37ebc323f99 100644 --- a/code/lib/cli/src/generators/REACT/index.ts +++ b/code/lib/cli/src/generators/REACT/index.ts @@ -1,8 +1,16 @@ +import { detectLanguage } from '../../detect'; +import { SupportedLanguage } from '../../project_types'; import { baseGenerator } from '../baseGenerator'; import type { Generator } from '../types'; const generator: Generator = async (packageManager, npmOptions, options) => { - await baseGenerator(packageManager, npmOptions, options, 'react'); + // Add prop-types dependency if not using TypeScript + const language = detectLanguage(); + const extraPackages = language === SupportedLanguage.JAVASCRIPT ? ['prop-types'] : []; + + await baseGenerator(packageManager, npmOptions, options, 'react', { + extraPackages, + }); }; export default generator;