Category "typescript"

function declaration for a generic function return wrapper

How to declare the function wraps that takes any function and returns a version of it that differs only in returning an object that wraps the original return ty

How to use normal imports and top-level await at the same time?

I want to use imports (import x from y) and top-level awaits at the same time with ts-node. However if I change my tsconfig.compilerOptions.module to es2017 or

Error while importing a module with optional chaining

Project setup: Vuejs 3 Webpack 4 Babel TS We created the project using vue-cli and add the dependency to the library. We then imported a project (Vue Currency

Show Validation Message on submit in Angular 4 Reactive Forms

I am using Angular 4, Reactive forms.I want to show validation error message when the user clicks on Submit/Create Account button. Here is the HTML and typescr

Unable to import svg files in typescript

In typescript(*.tsx) files I cannot import svg file with this statement: import logo from './logo.svg'; Transpiler says:[ts] cannot find module './logo.svg'.

what is the purpose of "export as namespace foo"?

I'm using some *.d.ts files and I see in many of them the following two lines: //foo.d.ts export = foo; export as namespace foo; declare var foo; [...] I can

Converting Flow to TS - 'Component cannot be used as a JSX component' when imported from installed library

I have recently started to convert an older React 15 with Flow types codebase to an up-to-date CRA with TS. I used the flow-to-ts script to convert all the file

What is the type/class of a dynamically imported module in typescript?

I have problem finding the type of an imported module in typescript, could someone help me? To clarify my question I have a module module.ts export class RSL1 {

ngx-Bootstrap 4 dropdown and navbar not working with Angular 7

I am trying to add Bootstrap 4 to Angular 7, I see the styles are overridden by bootstrap styles, but navigation bar and dropdown box is not working. I followe

Cannot get gridApi in Ag-Grid using React hooks in Typescript

I am using function component in react with typescript. Here is what my component looks like const Table = (props: TableProps) => { const [gridApi, setGridA

TypeScript extra keys in nested objects

My problem can be summed up with this little snippet (here's a larger, interactive example in the Playground): type X = {x: number}; type Y = {y: number}; type

Scroll to element on click in Angular 4

I want to be able to scroll to a target when a button is pressed. I was thinking something like this. <button (click)="scroll(#target)">Button</button&

Formik onSubmit function is not working on my code

I am creating a form by using react and formik.Below is my code: <div> <Formik initialValues={{ email: "" }} onSubmit={(values: FS

How to call angular function when click p-dialog close(X) button?

How to call angular function when click p-dialog close(X) button? I have searched and just tried this (onHide)="cancel()" . But it's not working. Kindly sha

paths is not working in tsconfig.app.json as expected

I am using Angular to develop my website. And I wanna set a BASE_API for my project depends on prod or dev. Therefore, I add some code in environment export

Is there a way to check for both `null` and `undefined`?

Since TypeScript is strongly-typed, simply using if () {} to check for null and undefined doesn't sound right. Does TypeScript have any dedicated function or

This is not the tsc command you are looking for

When I run tsc in the terminal (it does not matter where) I get returned: This is not the tsc command you are looking for I do not have TypeScript installed

How to use a git submodule with typescript code in a typescript project

I'm working on a VueJS project that uses different colors and some other things depending on a environment variable. These values are contained in another repos

Types of parameters 'event' and 'event' are incompatible

I have a project, which is an employee monitoring project, and it has several components, and among these components is having a group of buttons together. I ha

How to iterate over keys of a generic object in TypeScript?

I need to iterate over a large object which is just typed as "object". It contains an unknown number of objects of the same type. In older posts I had found so