Cahnis

u/Cahnis



r/typescript•

For example:

const userPermissions = ['create', 'update', 'delete', 'read'] as const

const TUserPermission = typeof userPermissions[number]

How would you make a typeHelper that only allows distinct values from userPermissions or an empty array?

Example:

type SomeTypeHelper = ????

type TUserPermissions = SomeTypeHelper<TUserPermission>

const userPermissions: TUserPermissions = ['create', 'update'] // valid

const userPermissions: TUserPermissions = [] // valid

const userPermissions: TUserPermissions = ['create', 'update', 'update'] // error

const userPermissions: TUserPermissions = ['create', 'xablau'] // error

Trying to figure something out but I can't quite get it right

107

r/webdev•

I have a flow where i need to do stuff on an webapp, then i need to do stuff on a mobile app and then i need to check if changes happened back in the webapp.

I am having a bit of trouble finding something apropriate. Using react/node for the webapp and android kotlin for the mobileapp.

My intention is making an e2e test and some automations

10

r/reactjs•

So I was reading scaling up with reducer and context at react.dev, it made a lot of sense to me in a refactor I am currently doing at work (I can't use global state and fetch libs atm).

But one thing confused me, why does the docs recommend creating two different contexts on that page, one for the dispatch and one for the state?

Follow up question, if I had some computed memoized that was consumed in multiple places? Where would it live? Do I create a new context for it?

Thanks in advance!

106

r/rails•

So I got hired as a Jr dev to work on a ruby-on-rails app and surrounding tooling. First job in the field. Very little OOP experience with a bit o node. I was looking for a fullstack but mainly for a frontend preferrably react position.

I have never written a single line in ruby or ruby-on-rails. The company knows this, they are a very small startup and there are two other dev.

I promised that I would use my free time to learn RoR and ruby ASAP.

So first of all... I am freaking terrified, and I want to do good for the business. So I guess I need to learn to speedrun learning ruby and RoR.

Long story short, could you guys give me some general advice? Not only ruby-wise, but job-wise as we

3185