File tree Expand file tree Collapse file tree 6 files changed +27
-21
lines changed Expand file tree Collapse file tree 6 files changed +27
-21
lines changed Original file line number Diff line number Diff line change @@ -269,15 +269,6 @@ jobs:
269
269
yarn workspace @mui/material typescript:module-augmentation
270
270
yarn workspace @mui/base typescript:module-augmentation
271
271
yarn workspace @mui/joy typescript:module-augmentation
272
-
273
- - restore_cache :
274
- name : Restore generated declaration files
275
- keys :
276
- # #default-branch-switch
277
- # We assume that the target branch is `master` and that declaration files are persisted in commit order.
278
- # "If there are multiple matches, the most recently generated cache will be used."
279
- - typescript-declaration-files-master
280
-
281
272
- run :
282
273
name : Diff declaration files
283
274
command : |
@@ -286,7 +277,6 @@ jobs:
286
277
git add -f packages/mui-utils/build || echo '/utils declarations do not exist'
287
278
yarn lerna run build:types
288
279
git --no-pager diff
289
-
290
280
- run :
291
281
name : Any defect declaration files?
292
282
command : node scripts/testBuiltTypes.mjs
Original file line number Diff line number Diff line change @@ -85,6 +85,6 @@ Ripple.propTypes = {
85
85
* exit delay
86
86
*/
87
87
timeout : PropTypes . number . isRequired ,
88
- } ;
88
+ } as any ;
89
89
90
- export default Ripple ;
90
+ export default Ripple as ( props : RippleProps ) => JSX . Element ;
Original file line number Diff line number Diff line change @@ -293,6 +293,6 @@ TouchRipple.propTypes = {
293
293
* @ignore
294
294
*/
295
295
className : PropTypes . string ,
296
- } ;
296
+ } as any ;
297
297
298
298
export default TouchRipple ;
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ SliderRoot.propTypes /* remove-proptypes */ = {
105
105
* @ignore
106
106
*/
107
107
children : PropTypes . node ,
108
- } ;
108
+ } as any ;
109
109
110
110
export { SliderRoot } ;
111
111
@@ -145,7 +145,7 @@ SliderRail.propTypes /* remove-proptypes */ = {
145
145
* @ignore
146
146
*/
147
147
children : PropTypes . node ,
148
- } ;
148
+ } as any ;
149
149
150
150
export { SliderRail } ;
151
151
@@ -193,7 +193,7 @@ SliderTrack.propTypes /* remove-proptypes */ = {
193
193
* @ignore
194
194
*/
195
195
children : PropTypes . node ,
196
- } ;
196
+ } as any ;
197
197
198
198
export { SliderTrack } ;
199
199
@@ -294,7 +294,7 @@ SliderThumb.propTypes /* remove-proptypes */ = {
294
294
* @ignore
295
295
*/
296
296
children : PropTypes . node ,
297
- } ;
297
+ } as any ;
298
298
299
299
export { SliderThumb } ;
300
300
@@ -391,7 +391,7 @@ SliderValueLabel.propTypes /* remove-proptypes */ = {
391
391
* @ignore
392
392
*/
393
393
children : PropTypes . element ,
394
- } ;
394
+ } as any ;
395
395
396
396
export { SliderValueLabel } ;
397
397
@@ -438,7 +438,7 @@ SliderMark.propTypes /* remove-proptypes */ = {
438
438
* @ignore
439
439
*/
440
440
children : PropTypes . node ,
441
- } ;
441
+ } as any ;
442
442
443
443
export { SliderMark } ;
444
444
@@ -490,7 +490,7 @@ SliderMarkLabel.propTypes /* remove-proptypes */ = {
490
490
* @ignore
491
491
*/
492
492
children : PropTypes . node ,
493
- } ;
493
+ } as any ;
494
494
495
495
export { SliderMarkLabel } ;
496
496
Original file line number Diff line number Diff line change @@ -50,4 +50,4 @@ SliderValueLabel.propTypes = {
50
50
children : PropTypes . element . isRequired ,
51
51
className : PropTypes . string ,
52
52
value : PropTypes . node ,
53
- } ;
53
+ } as any ;
Original file line number Diff line number Diff line change @@ -54,6 +54,22 @@ async function main() {
54
54
55
55
async function rewriteImportPaths ( declarationFile ) {
56
56
const code = await fse . readFile ( declarationFile , { encoding : 'utf8' } ) ;
57
+ const basename = path . basename ( declarationFile ) ;
58
+
59
+ if (
60
+ // Only consider React components
61
+ basename [ 0 ] === basename [ 0 ] . toUpperCase ( ) &&
62
+ code . indexOf ( "import PropTypes from 'prop-types';" ) !== - 1
63
+ ) {
64
+ throw new Error (
65
+ [
66
+ `${ declarationFile } imports from 'prop-types', this is wrong.` ,
67
+ "It's likely missing a cast to any on the propTypes declaration:" ,
68
+ 'ComponentName.propTypes = { /* prop */ } as any;' ,
69
+ ] . join ( '\n' ) ,
70
+ ) ;
71
+ }
72
+
57
73
let fixedCode = code ;
58
74
const changes = [ ] ;
59
75
You can’t perform that action at this time.
0 commit comments