Wrong typings for z.enum

Hello everyone i have a code like this: import { z } from 'zod' const options = [ ["a", { label: "A" }], ["b", { label: "B" }], ] as const export function optionsToEnum(entries: ReadonlyArray): [T, ...T[]] { const [firstVa

Continue reading →

ERROR in ./node_modules/jsonwebtoken/sign.js 16:4-21

In react js with typescript i am gatting this type error. I was try multiple solution but, i cant be able to resove it. Please help me to solve.I was try webpack.config.js solution,rtl.config.js solution and other lots of solution which

Continue reading →

Typescript infer type inside a condition block (Object, forEach)

I've written a utility function which accepts an object of Record type, removes null values and returns a new object of Record type. The questions is why typescript compiler doesn't infer filters[key] type as string | string[] type after

Continue reading →

Getting npm ERR! code E429 Too many Requests Error when trying to publish a npm package

I'm trying to publish my typescript/nodejs package/project to npm but getting ERR! code E429 Too many requests I just created a game on typescript/nodeJS and tried to publish it on npm by first "npm login" and after that i used "npm publ

Continue reading →

How can I centralize dependecny version when using `nx` in a monorepo with `yarn4 png`?

I have a typescript monorepo managed by nx. There are about 122 projects in this repo and all written in typescript nodejs. With yarn4 pnp enabled https://yarnpkg.com/features/pnp. There are some 3rd party dependencies used by most of th

Continue reading →

Playwright fetch can't retrieve Post request ended up with test ended error

lately I was doing some research of playwright .. my use case is get Post api call response while page loading and print out for further process...,I came across an issue that fetch post always returns Test ended it fails right at the fe

Continue reading →

ionic 5 ....ion-input password clears password on focus

ion-input type password is clearing password when you type once and then again come back to this field and type something. it will clear password field. But type changed to text ,the issue is gone expecting It should not clear previous p

Continue reading →

how to use useEffect to set a state but also prevent the infinite re-render?

I have a state as below: const [doctor, setDoctor] = useState(null) and then a useEffect function as follows: useEffect(() => { if(!doctor){ axios.get(`doctor/${id}`).then(({data}) => { setDoctor(data

Continue reading →

NextJS Lighthouse Best Practices: Properly defines charset Error

I get this error on my blog page: Properly defines charset Error! A character encoding declaration is required. It can be done with a tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. Learn more about

Continue reading →

Use value of a property to check another property instead of using Generic

I am designing a type definition like this type ApiConfig = { selectedTags: Array } My purpose is to force the value selectedTags has to be an array that is a subset of TagTypes like this: const apiConfig: ApiConfig = { selectedTags

Continue reading →

How to wait until all data is generated in a child component using typescript/angular?

How do I ... "Wait" for a data that is being accessed using @ViewChild from a parent component in a child component that is only accessed when a event is sent by this child component to the parent component? So, for clarifying... I have

Continue reading →

TypeScript infers optional fields for Yup schema when using .required()

I am validating my create campaign form by building yup schema. This form has a field called sellers and the field will be array of object with type of {id: number; label: string}. Typescript infers type of sellers object with optional m

Continue reading →

Property 'isLoading' does not exist on type 'UseMutationResult<AxiosResponse<any, any>, Error, void, unknown>'.ts(2339)

I'm trying to create a delete function wherein It will show a loading state using useMutate of tanstackquery, but the problem is when I delete the button, it doesn't show the loading state even though I change the network speed. const B

Continue reading →

How can one instance method call another instance method by using its name?

In my class MyClass, I'm writing an instance method callByName that calls another instance method when passed the other method's name. But I keep getting type errors when attempting to actually call the method: Typescript playground clas

Continue reading →

Recursively generating keyed type for a const tree-like structure

I have a constant tree-like object to model nested relations and am trying to build a type that keys these relations by a fixed property of the parent object; i.e. I want to take this: const tree = { label: 'root', leaves: [

Continue reading →

req.session.isAuthenticated isn't working (express-session)

I've been working on a react app (localhost:3000) that uses an external API (localhost:8000). I tried to implement a session-based authentification system using express-session. When I log in, req.session.isAuthenticated is true. However

Continue reading →

Union types do not work when combined with `Omit<>`

I have the following interfaces: export interface Base { a: string; b: string; } export interface Foo extends Base { c: string[]; type: 'foo'; } export interface Bar extends Base { c: string; type: 'bar'; } From these

Continue reading →

How to fix Socket.io with nitro server in NuxtJS 3?

I'm trying to use socket.io with the NuxtJS 3 nitro server. The problem is that my websocket only works in development mode. When I send it to production I cannot receive a response from the websocket. Maybe it's because I'm not using th

Continue reading →

How to find the case or method of three.js packaging box

https://www.packola.com/pages/tool?sku=SHIPBOX-ST:RSC-L:12-W:12-D:12-MT:WHT-FLT:B-CL:40-TA:10-QTY:250&page_id=25&page_revision_id=10414 The above is the case I want to simulate. The length, width and height of the packaging box model can

Continue reading →

Javascript: email string array cannot be found

Im trying to write a basic ts function to set an array of authorized emails, but checking it with these logs export const createSection = async (section: Section): Promise => { const newSectionRef = await setDoc( doc(sectionsCollec

Continue reading →