Category "typescript"

Nodejs + typescript how to use class models?

I am trying to learn how to use class models in nodejs and I will give you an example of what I am trying to achieve. For example I have user.ts model : expo

How to get the version from the package.json in Typescript?

I have found this Q&A. I have tried to get the version from the package.json using: import { version } from './package.json'; but it results in: packag

UseDapp - useCall - How to get return value from Solidity function?

I am still quite new with react and solidity and don't know where to start. I can update a String and want to print it out after I changed it. But I want the St

Background image in tailwindcss using dynamic url (React.js)

I have an image url fetched from an API and I want to display it as a background image. Is there any way I can implement this with tailwindcss or should I use s

Understanding type definition files in Node JS and TypeScript

I'm trying to understand how TypeScript projects resolve the import of modules installed via npm and their type definition files. As far as I know (and followi

AngularFireFunctionsModule from AngularFire Causes build errors

I've run into a bit of a snag when adding in the AngularFireFunctionsModule. For some reason, despite having successfully included AngularFireModule, AngularFir

Amplify ID for a @belongTo (to one) relationship not in the generated Typescript model

I have an error message from VSCode when using the "foreign key" property for storing an object. I've implemented the exact example from their documentation: ht

Cannot find module 'ts-node/register'

I want to use mocha to test my TypeScript/Angular2 project. I tried to use ts-node as described here: npm install -g ts-node but when running mocha --r

no-use-before-define typescript interfaces

I have 2 typescript interfaces that have a member that is of the type of the other interface (circular reference). My linter complains that I cannot use an inte

TypeScript TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'

Im getting this compilation error in my Angular 2 app: TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. The piec

Where are the TypeScript type declarations for Sign in With Google (GSI) library?

I'm implementing "Sign in with Google" using the Google "GSI" library. My application uses Next.js and TypeScript, so I'm looking for: An npm package including

EAS build can't find aws-exports

I have an Expo project with AWS Amplify. I'm currently using EAS from Expo to deploy on mobile. Pretty often I run on this error: ❌ Metro encountered an

How to specify (optional) default props with TypeScript for stateless, functional React components?

I'm trying to create a stateless React component with optional props and defaultProps in Typescript (for a React Native project). This is trivial with vanilla J

How to test ng-web-apis/geolocation Observable in angular 8?

I'm trying to test a simple angular 8 service that gets user location using GeoLocation Service from Web APIs for Angular public enableGPS() { if (!this.lo

react-router-dom <Routes> and <BrowserRouter> errors

I am using react-router-dom and am facing an issue with using <Routes>: Here is my index.tsx file: import React from 'react'; import ReactDOM from 'react-

tsc.ps1 cannot be loaded because running scripts is disabled on this system

On PowerShell, I got the error message when executing tsc. This never happened before. I am not sure should I mingle with the PowerShell security settings to r

Input and outputs, how to work with them to follow the naming convention of the Angular 2's styleguide?

Before I knew any better I used to have my directive defined like this: ... inputs: [ 'onOutside' ] ... export class ClickOutsideDirective { @Output() on

How to manage Angular2 "expression has changed after it was checked" exception when a component property depends on current datetime

My component has styles that depend on current datetime. In my component I've got the following function. private fontColor( dto : Dto ) : string { // da

About "*.d.ts" in TypeScript

I am curious about .d.ts declaration files because I am new to the TypeScript programming language. I was told by someone that .d.ts files are are similar to .h

nextjs API with typescript, restricting NextApiRequest query param to just string type [duplicate]

In this endpoint handler, is there a way to restrict req.query in NextJS NextApiRequest to just string types rather than string | string[]. Fo