JSFiddle - React, Tailwind, and code Playground

by David Kyle

TypeScript

class Something {
	public name: string;
  constructor() {
  	this.name = '';
  }
}

class OtherThing {
	public limit: number;
  
  constructor() {
  	this.limit = 2;
  }
}

function doSomething<TSomething>(input: { new(): TSomething }) {
	console.log(input);
	console.log(input.name);
}

doSomething<Something>(Something);
doSomething<OtherThing>(OtherThing);

console.log('type', OtherThing.name);