@types/xxxx package and had problems.Definitions by: in index.d.ts) so they can respond.// allow undefined, but don't make it optional as that is very likely a mistake
function useMemo<T>(factory: () => T, deps: DependencyList | undefined): T;
I think this is not correct. this function is designed to have optional deps param.
and also conflict with eslint-react-hooks. see the example below.
I wanted make editor model only once. so l wrote code like this.

and got this warning.

so I removed empty array and then I got this

I know that this model variable can be exist ouside of the function. but I'm curious that this function can be used without deps param in js but why cannot used like this in TS.
thanks for reading!
I'm not sure if this is already in a release version of the eslint plugin, but omitting the second argument is _also_ an error according to the eslint plugin.
See this check from the current eslint plugin code in master.
The reason why the argument cannot be omitted in the types is because, if you omit it, you are 99% of the time making a mistake. useCallback(x) without the second argument is _identical_ to just x (whatever x is) but with more CPU and memory overhead. useMemo(x) is identical to just x() unless x is a function declared outside the component; in which case you can probably just do useMemo(x, undefined), or useMemo(x, [x]).
thank's for the response. nice explaination! I'll close this issue.
Most helpful comment
I'm not sure if this is already in a release version of the eslint plugin, but omitting the second argument is _also_ an error according to the eslint plugin.
See this check from the current eslint plugin code in master.
The reason why the argument cannot be omitted in the types is because, if you omit it, you are 99% of the time making a mistake.
useCallback(x)without the second argument is _identical_ to justx(whateverxis) but with more CPU and memory overhead.useMemo(x)is identical to justx()unlessxis a function declared outside the component; in which case you can probably just douseMemo(x, undefined), oruseMemo(x, [x]).