Your project's baseUrl
can only be set to src
or node_modules
. Create React App does not support other values at this time.
- Add src/.env
- Add src/path.json
type NullAbleType<T> = {[K in keyof T]: T[K] | null}
type Option = { money: number, fn: (...arg: any[])=> void}
type User = {name: string, age: number}
type UserWithOPtionNullAble = User & NullAbleType<Partial<Option>>
// const obj:UserWithOPtionNullAble = {name: "kenji", age: 99, money: 222, fn: ()=>{}}
type NullAbleType<T> = {[K in keyof T]: T[K] | null}
type User = {name: string, age: number, money: null, fn: (...arg: any[])=> void}
type FunctionType<T> = {[K in keyof T]: T[K] extends Function? T[K] : never}[keyof T]
type FunctionName = "fun"
type NullAbleUserAndRequireFunction<T> = NullAbleType<Partial<User>> & {[K in T extends FunctionName ? T: never]: FunctionType<User>}
const obj:NullAbleUserAndRequireFunction = {name: null, age: 99, money: null, fun: ()=>{}}
Error: Uncaught [TypeError: Cannot read property 'addEventListener' of undefined]
console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9215
The above error occurred in the <Connect(OpenDialogIconButton)> component:
in Connect(OpenDialogIconButton) (at ManageApp/index.tsx:373)
in Tooltip (created by WithStyles(Tooltip))
in WithStyles(Tooltip) (at ManageApp/index.tsx:372)
このような型付をみつけて
const a: Record<string, string> = {
doorToDoor: "delivery at door",
airDelivery: "flying in",
FAIL src/components/AuthorityUserSettingItem/index.test.tsx ● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
[解決]failed prop type: Invalid prop children
supplied to ForwardRef(Typography)
, expected a ReactNode
titleIconElement
////////
<AppList listTitle="タイトル" appInfos={ownAppInfos} showAllUrl={"/apps"} titleIconElement={<></>} />
<AppList listTitle="タイトル" appInfos={favoriteAppInfos} showAllUrl={"/apps/favorite"} titleIconElement={<></>} />
<AppList listTitle="タイトル" appInfos={presetAppInfos} showAllUrl={"/apps/preset"} titleIconElement={<></>} />
let obj:{ [key: string]: string} = {}
// ここではそれぞれの型引数(T,U)はお互いの関係性は知らない
function someFunction <T, U> (t: T, u: U): T {
return t;
}
const dog = someFunction(new Dog(), new Cat());
// これを `T extends U` とすることで第二引数のU型を制約とするTになった
function someFunction (t: T, u: U): T {