Nice one ! I recommand you to use const rather than let if you didn't reassign variable as :
const
let
const createNewArray = <T>(value: T): Array<T> => { const output : Array<string> = []; output.push(value); 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.. :-)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice one !
I recommand you to use
const
rather thanlet
if you didn't reassign variable as :And last tips, you can declare type array as below for an array of string.
Sure.. will change it..thanks for the heads up.. :-)