We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to get returnType of useSomethingSearchParams('/sign-up')
useSomethingSearchParams('/sign-up')
I think I have to use ReturnType<ConvertTable[TPath]>;
ReturnType<ConvertTable[TPath]>;
but ConvertTable was not exported..
type Pathname = keyof ConvertTable; export default function useSomethingSearchParams<TPath extends Pathname>(path: TPath) { const {query} = useRouter(); if (!convertTable[path]) throw new Error(`unknown path: ${path}`); return convertTable[path](query) as ReturnType<ConvertTable[TPath]>; } type ConvertTable = typeof convertTable; const convertTable = { '/sign-up': (query: ParsedUrlQuery) => { const result: any = {}; { // "temporaryCode" const value = query['temporaryCode']; if (value == null) { result['temporaryCode'] = null; } else if (Array.isArray(value)) { result['temporaryCode'] = value[0]; } else { result['temporaryCode'] = value; } } // .... return result as { readonly temporaryCode: string | null; }; }, } as const;
The text was updated successfully, but these errors were encountered:
ConvertTable이 직접 필요한 상황인가요?
ConvertTable
useSomethingSearchParams('/sign-up')의 반환 타입이 알고싶은 경우는 실제로 호출도 해봐야 할 상황일 것 같은데,
const searchParams = useSomethingSearchParams('/sign-up'); type X = typeof searchParams;
이렇게 알아내는 방법으로는 부족할까요?
Sorry, something went wrong.
네 함수 호출 전에 알아야해요. https://github.com/riiid/www/blob/f987fc8ee7e5fdcb7a859baf0f0318bacb6a9a64/testprep-classroom-web/src/pages/sign-up/SignUpContainer.tsx#L83-L88
No branches or pull requests
I want to get returnType of
useSomethingSearchParams('/sign-up')
I think I have to use
ReturnType<ConvertTable[TPath]>;
but ConvertTable was not exported..
The text was updated successfully, but these errors were encountered: