Posts

Showing posts from June, 2022

typescript enums vs unions

Typescript enums have their uses but are extra hassle when creating new dto instances. I don't think enums are a good fit for working with dtos.  When I try to instantiate a new AutoTagsConfigType instance as mock data for tests, typescript is reporting an error for the  status  field because it's defined as an  ATStatus  enum So setting status to a literal like this is not acceptable to typescript const mockData: AutoTagsConfigType = { status: 'Pending', id: 'd3f963fb-2201-4f5c-ae38-21bf22cec001', name: 'Big Spender', } but setting status as:  status: ATStatus.Pending  does work however that's not very nice to have to do (use the enum type all the time, I prefer using literals) especially if typescript has another way of achieving the same goal (limit status values) using unions if ATStatus is a union not an enum, then setting values literally works as we would like and typescript will only allow set one of those values type ATStatus = &#

web3 graph and identity

I build a small app to view successful transactions by querying a mock near graph response I created my own variation of the graph on thegraph.com . More on the graph   I like the idea of owning your own data and your own identity, it's a powerful idea. Why lock up your identity and data in closed systems? Why not instead have a global identity you own and you control which systems can query and edit. Owning your own identity and data...what an idea!  " The next wave of transformative innovation will be in applying the same open source principles to the world's information" Ceramic has some interesting blogs on how web3 apps are building composable trust  One use case is owned identity and y ou can create your own identify with self.id  as per  implementation by ceramic . Decentralized Identifiers  are used in this scenario. Ethereum provides a web3 js library  to work with Ethereum. Figment provides products and learning resources for web3. learn.figment.io is a g