skip to Main Content

Javascript – Difference between bracket notation property access and Pick utility in TypeScript

I have an interface like below export type CameraProps = Omit<React.HTMLProps<HTMLVideoElement>, "ref"> & { audio?: boolean; audioConstraints?: MediaStreamConstraints["audio"]; mirrored?: boolean; screenshotFormat?: "image/webp" | "image/png" | "image/jpeg"; //between 0 & 1 screenshotQuality?: number; videoConstraints?: MediaStreamConstraints["video"]; fullScreenRecord?: boolean; screenshotDimensions?: ScreenshotDimensions; setImageSrc?: Dispatch<SetStateAction<string>>;…

VIEW QUESTION

Javascript – Is it necessary to define type again in useState if an interface is already used?

Consider this code: IAppStateProps.ts: import {INoteProps} from "./INoteProps"; export interface IAppStateProps { notesData: INoteProps[]; } then use it here: useAppState.ts: import {INoteProps} from "./interfaces/INoteProps"; import {IAppStateProps} from "./interfaces/IAppStateProps"; export const useAppState = (): IAppStateProps => { const [notesData, setNotesData] =…

VIEW QUESTION
Back To Top
Search