Skip to content

re: TypeScript Basics - A Definitive Guide VIEW POST


Nice one !
I recommand you to use const rather than let if you didn't reassign variable as :

const createNewArray = <T>(value: T): Array<T> => {
    const output : Array<string> = [];


    return output;

And last tips, you can declare type array as below for an array of string.

const output: string[] = []; // Array of string
const output2: number[]; // Array of number, etc...

Sure.. will change it..thanks for the heads up.. :-)

code of conduct - report abuse