File tree Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 11
11
"test" : " vitest" ,
12
12
"lint" : " eslint ." ,
13
13
"lint:fix" : " eslint --fix ." ,
14
- "generate-types" : " npm run docs && node utils/generate-types"
14
+ "generate-types" : " npm run docs && node utils/generate-types && node utils/patch "
15
15
},
16
16
"lint-staged" : {
17
17
"Gruntfile.js" : " eslint" ,
Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+
3
+ const replace = ( path , src , dest ) => {
4
+ try {
5
+ const data = fs
6
+ . readFileSync ( path , { encoding : 'utf-8' } )
7
+ . replace ( src , dest ) ;
8
+ fs . writeFileSync ( path , data ) ;
9
+ } catch ( err ) {
10
+ console . error ( err ) ;
11
+ }
12
+ } ;
13
+
14
+ replace (
15
+ "./src/core/structure.d.ts" ,
16
+ "function p5(sketch: object, node: string | HTMLElement): void;" ,
17
+ "function p5: typeof p5"
18
+ ) ;
19
+
20
+ replace (
21
+ "./src/webgl/p5.Geometry.d.ts" ,
22
+ "constructor(detailX?: number, detailY?: number, callback?: function);" ,
23
+ `constructor(
24
+ detailX?: number,
25
+ detailY?: number,
26
+ callback?: (this: {
27
+ detailY: number,
28
+ detailX: number,
29
+ vertices: p5.Vector[],
30
+ uvs: number[]
31
+ }) => void);`
32
+ ) ;
33
+
34
+ // https://github.com/p5-types/p5.ts/issues/31
35
+ replace (
36
+ "./src/math/random.d.ts" ,
37
+ "function random(choices: Array): any;" ,
38
+ "function random<T>(choices: T[]): T;"
39
+ ) ;
40
+
41
+ replace (
42
+ "./src/utilities/array_functions.d.ts" ,
43
+ "function append(array: Array, value: Any): Array;" ,
44
+ "function append<T>(array: T[], value: T): T[];"
45
+ ) ;
46
+
47
+
You can’t perform that action at this time.
0 commit comments