CODY
CODY
Explore posts from servers
TTCTheo's Typesafe Cult
Created by CODY on 7/8/2023 in #questions
How can I make node.js package that have a custom command?
Like "npm", "next", "prisma", "drizzle", etc. things whenever you start a command. How do I find terms/keywords to implement this.
1 replies
TTCTheo's Typesafe Cult
Created by CODY on 2/18/2023 in #questions
Type a function based on its argument value.
I have a function that takes an object and a boolean (default to false). It will return an array of object with key id only if parameter bool of the function set to true.
const helpMeTypeThis = (obj: MyObj, bool = false)
: {id?: string | undefinded, [key: string]: any }[] => {
return obj.map(...)
}

helpMeTypeThis(obj) // => { [key: string]: any }
helpMeTypeThis(obj, false) // => { [key: string]: any }
helpMeTypeThis(obj, true) // => { id: string, [key: string]: any }
const helpMeTypeThis = (obj: MyObj, bool = false)
: {id?: string | undefinded, [key: string]: any }[] => {
return obj.map(...)
}

helpMeTypeThis(obj) // => { [key: string]: any }
helpMeTypeThis(obj, false) // => { [key: string]: any }
helpMeTypeThis(obj, true) // => { id: string, [key: string]: any }
2 replies
TTCTheo's Typesafe Cult
Created by CODY on 2/13/2023 in #questions
How to fix env types on `schema.mjs`?
3 replies