any
type JS-032345
46/** Server */
47const httpServer = http.createServer(router);
48const PORT: any = process.env.PORT ?? 6060;49httpServer.listen(PORT, () => console.log(`The server is running on port ${PORT}`));
358 threeduftypestring = "Template";
359 }
360 const definition = ComponentAPI.library[threeduftypestring].object;
361 const params_to_pass: { [index: string]: any } = {};362 params.forEach((value, key) => {
363 params_to_pass[key] = value;
364 });
351 * @param minttypestring
352 * @return {void|Array}
353 */
354 static getComponentPorts(params: Map<string, any>, minttypestring: string): Array<ComponentPort> {355 let threeduftypestring = ComponentAPI.getTypeForMINT(minttypestring);
356 if (threeduftypestring === null) {
357 console.error("Component Ports of: " + threeduftypestring + " not found in library. Using default Template");
187 __tools: any;
188 __render2D: any;
189 __render3D: any;
190 name: any;191 setString: string | undefined;
192
193 /**
186 __setString: any;
187 __tools: any;
188 __render2D: any;
189 __render3D: any;190 name: any;
191 setString: string | undefined;
192
The any
type can sometimes leak into your codebase. TypeScript compiler skips the type checking of the any
typed variables, so it creates a potential safety hole, and source of bugs in your codebase. We recommend using unknown
or never
type variable.
In TypeScript, every type is assignable to any
. This makes any
a top type (also known as a universal supertype) of the type system.
The any
type is essentially an escape hatch from the type system. As developers, this gives us a ton of freedom: TypeScript lets us perform any operation we want on values of type any
without having to perform any checking beforehand.
The developers should not assign any
typed value to variables and properties, which can be hard to pick up on, especially from the external library; instead, developers can use the never
or unknown
type variable.
const age: any = 'seventeen';
const ages: any[] = ['seventeen'];
const ages: Array<any> = ['seventeen'];
function greet(): any {}
function greet(): any[] {}
function greet(): Array<any> {}
function greet(): Array<Array<any>> {}
function greet(param: Array<any>): string {}
function greet(param: Array<any>): Array<any> {}
const age: number = 17;
const ages: number[] = [17];
const ages: Array<number> = [17];
function greet(): string {}
function greet(): string[] {}
function greet(): Array<string> {}
function greet(): Array<Array<string>> {}
function greet(param: Array<string>): string {}
function greet(param: Array<string>): Array<string> {}