This file contains 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
{ | |
"image": "https://images.ctfassets.net/a9237abdyvg9/2GDeLs0jA3u3jHJsIlBTGT/d06c08a6f7a8e1bbdb34d43d8d78bc5f/boredape1.jpeg" | |
} |
This file contains 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
{ | |
"image": "https://www.highsnobiety.com/static-assets/thumbor/j2w6qxCWe_zs_suVSTfHEB_nCNo=/1600x1067/www.highsnobiety.com/static-assets/wp-content/uploads/2021/11/02170527/cryptopunk-nft-500-million-2.jpg" | |
} |
This file contains 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
{ | |
"attributes": [ | |
{ | |
"trait_type": "Breed", | |
"value": "Maltipoo" | |
}, | |
{ | |
"trait_type": "Eye color", | |
"value": "Mocha" | |
} |
This file contains 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
{ | |
"attributes": [ | |
{ | |
"trait_type": "Breed", | |
"value": "Maltipoo" | |
}, | |
{ | |
"trait_type": "Eye color", | |
"value": "Mocha" | |
} |
This file contains 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
const buttonTypeKeys = propertiesOf<typeof MyEnum>(); | |
const stringProperties = propertiesOf<string>(); | |
const promiseProperties = propertiesOf<Promise<unknown>>(); |
This file contains 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
// This will list all the readonly properties of MyInterface | |
const readonlyProperties = propertiesOf<MyInterface>({ readonly: true }); | |
// This will list all the optional properties of MyInterface | |
const optionalProperties = propertiesOf<MyInterface>({ optional: true }); | |
// This will list all the required properties of MyInterface | |
const requiredProperties = propertiesOf<MyInterface>({ optional: false }); | |
// But feel free to ask for private readonly OR public optional properties |
This file contains 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
import { propertiesOf } from 'ts-reflection'; | |
// FREEDOM!!! | |
const payloadKeys = propertiesOf<SomePayload>(); |
This file contains 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
const enumKey = ButtonType[ButtonType.PRIMARY] |
This file contains 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
console.log(buttonTypes); | |
// The output does not look like what we'd expect! | |
['primary', 'PRIMARY', 'secondary', 'SECONDARY', 'link', 'LINK'] |
NewerOlder