Category "typescript"

Capitalize the first word (or optionally all the words) of a sentence in angular 2+

I am trying to capitalize words of a string in the angular 2 template (aka view) but I get the following error in the console and the application does not load

How to implement two html files for the same component in angular 9? One for mobile sized and one for desktop?

I would like to implement an application with multiple components and modules using Angular Material for desktop and Ionic for mobile. So far, the solution I fo

How to make VSCode show me strictNullChecks Typescript errors

When I build my project with the following tsconfig.json, I get an error due to recently adding strictNullChecks: true. { "version": "2.3.4", "compiler

Explain "export =" and "export as namespace" syntax in TypeScript

I am trying to make use of the type declarations files in the DefinitelyTyped repository. Many of these files use the following pattern: export = React; export

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