Last active
May 3, 2020 14:32
-
-
Save haldarmahesh/e3a5a473b01457291b7d31d1b5144397 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Person { | |
name: String | |
} | |
export const convertToValueArray = (value: any): Array<any> => { | |
return [value]; | |
} | |
console.log(convertToValueArray(12)); // [12] | |
console.log(convertToValueArray("STRING")); // ["STRING"} | |
const person: Person = { | |
name: "Mahesh" | |
} | |
console.log(convertToValueArray(person)); // [ { name: "Mahesh" } ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment