[bugfix] Refactor prop types generation and add import optimisation #43736
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add type annotations to enhance the robustness of prop type generation. Introduce a new
optimiseImports
function to standardise import formats. Implement anoptimise
command for removing unnecessary imports in declaration files.Replaced all occurrences of
import PropTypes from 'prop-types';
withimport * as PropTypes from 'prop-types';
in the Material UI codebase related to@mui/utils
Bug Report: [Error] Incorrect Import of PropTypes Causes Compilation Error
This represents an initial step towards a solution for the TypeScript
tsc
compilerThis improvement offers a viable solution for the
tsc
compiler by organising utility functions across all files. While handling internal refactoring of just built/generated files may seem impractical, it’s worth considering. It appears there are more adaptable solutions, but they often generate incorrect outputs for TypeScript, as previously mentioned #43701, #43701 (comment), #43701 (comment). Notably, theprop-types
package remains unchanged. Therefore, this proposal represents the initial step in addressing thetsc
compiler issue.