Skip to content
Advertisement

Tag: typescript

How to extend class type with decorator

I’d like to use decorators in my project. Here’s what I have written: As you see this decorators creates a few fields. But typescript can’t recognize them It does exsist though. If I add @ts-ignore before using these parameters, the code works okay. I wounder, how can I create a class decorator, that would extend parent’s type. I tried to

Webpack fails to parse typescript files. Module parse failed: Unexpected token

I was setting up Typescript and Webpack on an old project of mine and suddenly encountered this error: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders Then I have created a new project from scratch that goes as follow: webpack.config.js tsconfig.json src/index.ts (sourced from here) …

ModuleFederationPlugin remote module is not being loaded

I have two apps. Container. Webpack App.tsx 2nd App. Webpack ./src/portal.tsx It should work smooth. But it is failing because inside of webpack_modules exists webpack/container/reference/usersweb key, but when React.Lazy requiring remote model it is requiring webpack/container/remote/usersweb/Portal which is not added and app crashes. remoteEntry.js loaded properly and I may see userweb object in the console. dependencies versions “react”: “^17.0.2”, “webpack”:

Convert Maybe[]’ to ‘string[]

I am using graphql with generated types and struggling with how to convert them to the type I need to pass it to my data service calls. @graphql-codegen has given me an args type of (I don’t really understand why its generated as a Maybe type, as the graphql schema enforces that I only query with a parameter of an

Get function reference from mssql TYPES object using string

Node.js / mssql / typescript I’m trying to build a set of input parameters dynamically and add them to a prepared statement. With the code below, the error I get is: Element implicitly has an ‘any’ type because expression of type ‘string’ can’t be used to index type ‘{ VarChar: ISqlTypeFactoryWithLength; NVarChar: ISqlTypeFactoryWithLength; Text: ISqlTypeFactoryWithNoParams; … 29 more …; Variant:

How to traverse a typed array?

I have the following class model in my application Angular: And my Controller: In the template I have a multiple select where I fill an array with the id’s of the chosen categories. Problem, I’m using ngModel to link the form with the controler, but to send the pre-filled data to the API, I have to format the id’s to

Advertisement