Typescript Questions
Ad
How to make dynamic import/require depend of variable with code cleanup?
I have react app created by "react-create-app" with latest react 16.12 and webpack i need to make import with dependence on variable, like
React TypeScript: How to call an api and set state each time the route changes
Useeffect fires perfectly each time i change the route, when i call the api from within useeffect, and then try to set state with the result i get
Concatenate text from React Hook
I have following hook: const [texttofront, settexttofront] = usestate(''); when i call
Updating a Material-UI TextField onBlur with Formik (React)
I'm currently rendering an editable table that lets the user bulk edit several user's information at once (see image). i'm using material-ui's
Firebase Cloud Functions Returning Processed Data Using onCall
I've been using firebase cloud functions and have run into the issue where my functions sometime hang for up to 10 seconds before returning data.
how to create state array react hooks on declaration
How do i create a state array with react hooks? i am passing a type i used this method but it's showing me lint error. i also want to know it's
React custom Component(DataTable)
Im new to react and im trying to build a custom componenet with parameters. im just wonding whats the exact way on doing it. here
Property 'toDate' does not exist on type 'FieldValue | Timestamp' but WORKS
I'm using cloud firestore to store chats, which i would like to sort by lastestmessage.created. i was not able to use the query because i was
Pass Children prop to React Memo component
I am currently in the process of optimising a number of react sfc components with the use of react.memo. most of these
Generics with Higher Order Function
I want to create a function that returns a constructor function for one of my existing react components. the return value is a
Ad
Re-rendering React component when I call useState hook
I have a problem with the re-rendering react component when i call usestate() hook inside image.onload(). i'm expecting
How do I import react-admin in a React Typescript appplication?
I'm trying to set up a react-admin app in typescript and i can't quite figure out how to import react-admin. it gives me the (simple) error saying
How to centralize snapshots folder in a React project?
I am in a project where i have to build a react ui. as it is a small project & i'm alone on it, i'd try to develop it with typescript & a
Type 'null' is not assignable to type 'Element'.ts(2345)
I am getting the following error: argument of type 'functioncomponent> & { wrappedcomponent: componenttype<{ intl:
React TypeScript: Convert text from input to number
I want to perform some basic arithmetic on the two input fields, but typescript and my linter are fighting against me... const
React Typescript: readonly: true; ' is not assignable to type 'DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>,
I'm trying to make an input field read-only <input type='text' name='email' readonly /> the error i get is
How to push a new item in an array with Firebase
I'm trying to push a new item in an array in firebase i've tried doing this but it just replace the first item of the array in
Can not use Leaflet with NextJS
I wanna use leaflet with nextjs(typescript). but leaflet dose not supported ssr. so, i use
Await function never executes
I have this function, that iterates through an array of strings, where each string represents a user's uid. the function is supposed to go to each
Import only used bits from firebase-admin when using Typescript in Cloud Functions
I glanced at my transpiled code from cloud functions and following typescript import import {
How to guarantee that passed object key is callable using Typescript?
I'm trying to create a react higher-order component for a specific use-case, the problem is boiling down to the following:
Ad
firebase cloud function showing error while i use the 'context' in callable function
This is the cloud function where i try to call context to use the auth token but it showing error. exports.checkcollege =
TypeScript React: How to pass all props to child function
I am new to typescript react. need help in converting the following react js code to typescript react. am really confused on how to pass the props
react-material table with typescript shows generic type error
I'm trying to run react-material under a typescript project.
Null condition is not checked in a react function component
In my components, i want to check initially if there is an authenticated user or not: const reviewroundoverall = (props) => {
How to update a value using in firebase realtime database?
So i am using cloud functions at the moment. what i am doing is this: export const onmessagecreate =
history.push doesn't show the destination path
This seems like a simple task, but can't seem to get it to work. i'm building a react spa running material ui and typescript. due to errors, when
typescript cannot find module when import svg file
It's web application created with typescript, react and webpack. i want to use svg file through webpack. however, i got
Is there a way to use value from type as a defaultProp in Typescript
I have the following type definition: type size = "m" | "s" i have a
Common toggle function doesn't work well with setState()
I have a state which represents this interface: stateinterface { variableone: string; variabletwo: boolean; variablethree:
React useState hooks error: Argument of type 'xxx' is not assignable to parameter of type 'SetStateAction<xx>'
I use react hooks to update, but notice error when setstate. argument of type '{ alertrules: any; }' is not assignable to
How can I render a react application compiled in a bundle.js?
So i have a react application that was compiled into a bundle.js file. the index.tsx file of the react application shows that the app component
Ad
Getting "TypeError: Cannot read property 'catch' of undefined" when executing a mailgun cloud function in firebase
I am trying to send an email using mailgun and firebase cloud functions. the mail is sent, but still returns an error that crashes my app. i
Set width for `PivotItem` in Office UI Fabric
I am using pivot and pivotitem from office ui fabric to display my content in tabs. currently when the tab renders, all
How to navgiate to a new page using react router dom with typescript
I want to navgiate to a new page after the user has logged in. typically i would use this.props.history.push("/some_other_page");
How to sort an object list retrieved from fire base?
I am fairly new to firebase and i noticed since firebase does not really store arrays i cannot sort them in the same way i would sort an array. i
How to call custom methods of React component while doing unit testing. I am using typescript
I am using react with typescript. can anyone tell me how to call the custom methods which is written in component inside unit testing. i
Displaying entries from fire base whose dates have not passed
I am working on an app where a user can book on certain dates, after booking i want the user to be able to view his appointments but only the ones
Inferring mapped props when using TypeScript and React-Redux
I found a way to get type safety when using mapstatetoprops from react-redux: as
Fetch data before resolve route
I´m using for routing "react-router" lib. before render page component, i need fetch data. i want show loader before every routing, because all
Simple react component - Expected an assignment or function call and instead saw an expression no-unused-expressions
I am following a book 'learn react with typescript' and i have finished chapter 3 but i can't seem to get my program to compile properly. i am
How to reuse jest mock of react-router's useHistory
I am mocking the usehistory of react-router-dom in my test like this:
Argument of type 'State' is not assignable to parameter of type 'never'
I have just started using typescript with react. i tried using it with react usereducer hook but i am stuck because of a weird error. here
Ad
Typescript error when using withRouter(withStyles(styles)(ComponentName))
I'm creating an spa using react with typescript. i've been using the ui framework material ui. i've run into an error now that i can't seem to
Property 'xxxx' does not exist on type '{}'
I am debugging a code i have not written, and i am new to typescript. i am getting a ts2339 error property 'inputfiles'
React component reference own DOM-element in typescript
Still being quite new to react i've run across the following issue: i'm creating a component this way: export const cspiderweb =
Add a static website from Azure Storage Account to an Asp.net MVC app?
I have to include a react application inside a dotnet mvc project. i have a simple react application that only contains a kendoui grid.
React: SetState does not update visual component
A function component does not perform its visual update when the state changes. i provide a minimal example of my component where i set a
Can I change in Firestore all documents in who correspond to a certain condition without querying for all of them first?
I am building some sort of a social network. to save read operations, for every post, i store the details of the author's details with it (image
Warning with function components cannot be given refs - even though using forwardRef() with Styled Components
I am receiving the warning warning: function components cannot be given refs. attempts to access this ref will fail. did you mean to use
Error: Type '{ children: Element[]; }' has no properties in common with type 'IntrinsicAttributes & RefAttributes<HTMLFormElement>'
I am trying to use formik in my react application. i have the login component written in ts. for some reason, the form
React Redux missing in props validation and recommended pattern for initialising container from an external API using redux-observable
I am trying to learn how to use react with redux in a typescript environment. i am using the patterns suggested at
Cloud functions using Cloud Firestore and TypeScript don't execute
Edit: after diving into the guides and following doug's answer i tried to edit my code but i still can't make it to work. this is my new code
Generate PropTypes from TypeScript
I am using react with typescript. i am also using proptypes. typescript is intended for compile time type checking while proptypes validate passed
Ad
Test Firebase authenticate Using Google Sign-In in jest
I cannot figure out how to jest mock firebase authentication with google login properly.i have the following code:
styled-components withTheme HOC not working with types React.FC
I'm building some components with react.fc typescript and today i found this typescript error when trying to inject styled-component props using
Namespace 'React' has no exported member 'FC'. in '@types/reactour'
I am working in a react application. i had my package.json file as follows. `{ ... ... "dependencies": {
data not loading onto list from API [ReactJs]
So i am currently working on an admin control panel that retrieves objects from an api. the api has two different endpoints, it's either
Escape single quote using fireSQL
I am using firebase firestore in my angular project and lately there is a project called firesql to use sql sentence query in firestore, it's
How to specify type parameters in typescript declaration?
I have created a react component that takes a class of its child component. this component is responsible for providing the user ability to login
How to repair a 'TS2769: No overload matches this call'
After package updates, i suddenly get weird typescript errors: [tsl] error in c:..\ui\src\sagas.ts(40,21)
Firing event in componentDidUpdate
I have following code: handlevalidate = (value: string, e: react.changeevent<htmltextareaelement>) => { const {
Query firebase nodes to get counts with dynamic paths
I'm trying to figure out a more elegant way of doing this... i am storing message objects and want to get the total number of
React/Typscript: typehint any doesn't work
I have a very simple react component named: github.tsx in it, i have this code: import react from 'react'
Is there any reason to use useIntl hook in react-intl v3.x?
We recently updated react-intl from version 2.x to 3.3.2, which meant that we could remove the injectintl hoc in all files that used any of the
Ad
React TypeScript: react-markdown no overload matches this call
I'm happy to move to another library if needed but react-markdown seems to have good reports, however, im getting the below error when i try to
How to create a ref using Typescript and styled-components
I'm trying to add a ref to react component like this: const dashboard: react.fc = () => { const
Using Ant Design's carousel next and previous pane methods in Typescript?
I am using ant design as the design framework for my application. the framework has a
How to order FireStore collection in angular Typescript
I am using firestore in angular, i would like to show a collection ordered by an attribute pos, i have no issue with importing the
how to insert data.json to react component with all properties in interface (typescript)
I has a productpage component, data.json and interface iproduct. now, i want to using map function fetch all data in data.json to productpage
How to use reselect createStructuredSelector function with typescript?
I am trying to build an react redux typescript app. i am using reslect library to create selectors. i am getting an error while
How do I define the type that the useState hook is expecting if I want to store an array of objects?
I am trying to store an array of objects using the usestate hook but cannot get the syntax for describing the type it is expecting.
How to create template strings in typescript?
I am trying to create some string literals for my code in typescript on the firebase cloud functions platform. i am using vs code as my code
how to order query From firestore based on timestamp in ionic 4
I've performed a query to firebase firestore and the data is being called perfectly. but i can't use any kind of ordering on this query.
Destructuring an object in TS
I have this ts code, and i want to make that part to be also typed : const { data: { person, car, another } }: any =
React + TypeScript error: No overload matches this call
I am receiving a massive error when mapping through an array like: // home.tsx render() { const { inputs, outputs,
Ad
Type inference of function as argument in Typescript
I have case as shown in images below - my function accepts options in form of object with one of arguments being transform function.
Cannot find module 'serviceAccountKey.json'
I'm trying to implement firebase functions and i'm stuck at importing my service account key from my project. this is my code.
Update document and app bar title when using React Router
I'm investigating the use of the react router in a typescript application. how would i update the document title (document.title) and
Why is my Firestore document wrapped inside a MAP object?
Upon pushing my event to firestore, my data inside the event id's is wrapped inside another event(supposedly, map() object). why is this the case?
Using lodash throttle with React text input and Typescript
I'm struggling to make this text input throttle work in react even after reading lots of docs. import { throttle } from 'lodash';
Generics that extend a static type aren't intellisensing
The handleonchange function does not autocomplete the key parameter and does not provide the correct type for
React.js - Redux Hooks Invalid Hook Call
I'm trying to use usedispatch inside my component's render function. import { usedispatch } from 'react-redux';
How to mock useHistory hook in jest?
I am using usehistory hook in react router v5.1.2 with typescript? when running unit test, i have got issue. typeerror:
How to fix problem with multiple menu item from material ui
When i try to put menu component many times i get wrong popup list. i show my problem on codesandbox link below. i put data-id attributes to show
React "interval" has always the same state
I am using react 16.10 with typescript. i have this code: const [state, setstate] = usestate<state>({ test: 1
Can't display variable data in HTML - Angular 8
I am trying to display the username of a logged in user in my html. i am using firebase for authentication purposes and angular 8 for the main
Ad
await for promise before give the result as input parameter
I have two components parent and child parent is resolving a promise in constructor, child is reveiving the result of the promise as
Angular2+ autofocus input element
How can i autofocus input element? similar to
Using BigInt in TypeScript
I believe i should be able to use bigint now in typescript...but changing some code base to use it and i get "cannot find name 'bigint'. (2304)"
Angular: wait for Observable inside a function before returning result
I need help with the following function: getuser(uuid: string): observable<wowuserdatamodel> { let user:
I need to have a 'container' template that has to show MyComponent upon certain condition 'externalCondition' MyComponent uses Form and formValidation
Container.html <div ngif="externalcondition"> <!--initially this is false. later became true --!>
Protractor - ScriptTimeoutError: script timeout - From: Task: Protractor.waitForAngular()
Everything worked out ok yesterday. today i did an update to get all commits from svn and nothing works anymore. whenever i run a test i
VSCode extension use multi step input directly
I want to use the multi step input directly, for example user choose f1 - and start the steps to choose items. currently i found the
Renderer2 error - id did not match any elements
So i have an input field which i would like to focus on load in an angular application. i read that the renderer2 way is the good method of doing
Angular arrays and ngFor
I have a html component with list <div *ngfor="let item of myarr"> <ul> <li> {{ item }}
convert from now() using Date to Moment Timezone from America/Los_Angeles
I would like to know if it is possible in typescript to convert date() to
Cannot assign to 'MyComponent' because it is not a variable (react-dnd multi drag&drop support in ReactJS
I would like to have drag and drop at the same time using react-dnd // ... imports ... class mycomponent extends
Ad
Cryptic Typescript compiler error using React: 'ComponentClass<StyledComponentProps<{}>>' is not assignable to type 'typeof MyComponent'
I'm trying to use the material ui 1.0 (beta) @withstyles annotation on a react component. the docs give a javascript example
Error: Template parse errors: Can't bind to 'myProperty' since it isn't a known property of 'myComponent'
After upgrading from angular 2.1.0 to 2.4.3 and webpack from 2.1.0-beta.25 to 2.2.0-rc.4 i recive this error if i run my webapp (the build works
Ad
Blog Categories
Ad