浏览代码

Merge pull request #19391 from tmkn/fix/typechecking

TS: Fixed type definitions for strict mode
Mr.doob 5 年之前
父节点
当前提交
e4ca432eb5

+ 1 - 1
examples/jsm/geometries/ParametricGeometries.d.ts

@@ -23,7 +23,7 @@ export namespace ParametricGeometries {
 
 	export class SphereGeometry {
 
-  	constructor( size: number, u: number, v );
+  	constructor( size: number, u: number, v: number );
 
 	}
 

+ 1 - 1
examples/jsm/loaders/obj2/worker/main/WorkerExecutionSupport.d.ts

@@ -58,6 +58,6 @@ export class WorkerExecutionSupport {
 	updateCallbacks( onAssetAvailable: Function, onLoad: Function ): void;
 	buildWorker( codeBuilderInstructions: CodeBuilderInstructions ): void;
 	isWorkerLoaded( requireJsmWorker: boolean ): boolean;
-	executeParallel( payload:object, transferables?: object[] );
+	executeParallel( payload:object, transferables?: object[] ): void;
 
 }

+ 1 - 1
examples/jsm/nodes/core/NodeBuilder.d.ts

@@ -114,7 +114,7 @@ export class NodeBuilder {
 	isDefined( name: string ): boolean;
 	getVar( uuid: string, type: string, ns: string, shader?: string, prefix?: string, label?: string ): object;
 	getVar( uuid: string, type: string, ns: string, label: string ): object;
-	getAttribute( name: string, type: string );
+	getAttribute( name: string, type: string ): any;
 	getCode( shader: string ): string;
 	getVarListCode( vars: object[], prefix?: string ): string;
 	getVars( shader: string ): object[];

+ 2 - 2
examples/jsm/nodes/utils/ColorSpaceNode.d.ts

@@ -10,8 +10,8 @@ export class ColorSpaceNode extends TempNode {
 	method: string | undefined;
 	nodeType: string;
 
-	fromEncoding( encoding: number );
-	fromDecoding( encoding: number );
+	fromEncoding( encoding: number ): void;
+	fromDecoding( encoding: number ): void;
 	copy( source: ColorSpaceNode ): this;
 
 	static Nodes: {

+ 1 - 1
examples/jsm/renderers/Projector.d.ts

@@ -76,6 +76,6 @@ export class Projector {
 
 	constructor();
 
-	projectScene( scene: Scene, camera: Camera, sortObjects: boolean, sortElements: boolean );
+	projectScene( scene: Scene, camera: Camera, sortObjects: boolean, sortElements: boolean ): any;
 
 }

+ 3 - 2
examples/jsm/utils/TypedArrayUtils.d.ts

@@ -1,6 +1,7 @@
 export namespace TypedArrayUtils {
 	export function quicksortIP( arr: any[], eleSize: number, orderElement: number ): any[];
 
+	type Points = Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array | Uint8ClampedArray;
 
 	export class Kdtree {
 
@@ -8,9 +9,9 @@ export namespace TypedArrayUtils {
 		root: Node;
 		private maxDepth: number;
 
-		constructor( points: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array | Uint8ClampedArray, metric: ( a: any, b: any ) => number, eleSize: number );
+		constructor( points: Points, metric: ( a: any, b: any ) => number, eleSize: number );
 
-		getPointSet( points: any, pos: number );
+		getPointSet( points: Points, pos: number ): Points;
 
 		buildTree(): Node;
 

+ 2 - 2
src/renderers/webgl/WebGLMaterials.d.ts

@@ -7,7 +7,7 @@ export class WebGLMaterials {
 
 	constructor( properties: WebGLProperties );
 
-	refreshUniforms( uniforms: object, material: Material, environment: Texture, pixelRatio: number, height: number );
-	refreshUniformsFog( uniforms: object, fog: IFog );
+	refreshUniforms( uniforms: object, material: Material, environment: Texture, pixelRatio: number, height: number ): void;
+	refreshUniformsFog( uniforms: object, fog: IFog ): void;
 
 }

+ 2 - 1
utils/build/tsconfig-examples.lint.json

@@ -1,7 +1,8 @@
 {
   "compilerOptions": {
     "noEmit": true,
-    "target": "ES6"
+    "target": "ES6",
+    "strict": true
   },
   "include": [
     "../../examples/jsm/**/*.ts"

+ 2 - 1
utils/build/tsconfig.lint.json

@@ -1,7 +1,8 @@
 {
   "compilerOptions": {
     "noEmit": true,
-    "target": "ES6"
+    "target": "ES6",
+    "strict": true
   },
   "include": [
     "../../src/**/*.ts"