WhatsApp-Clone-Client-React
WhatsApp-Clone-Client-React copied to clipboard
Type 'History<unknown>' is not assignable to type 'History<PoorMansUnknown>'.
after starting the project, the browser loaded the login screen, but immediately afterwards it showed the error below:
Failed to compile
/home/igormenin/Documentos/Desenvolvimento/testevenombots/WhatsApp-Clone-Client-React/src/App.tsx TypeScript error in /home/igormenin/Documentos/Desenvolvimento/testevenombots/WhatsApp-Clone-Client-React/src/App.tsx(26,58): Type 'History
' is not assignable to type 'History<PoorMansUnknown>'. The types of 'location.state' are incompatible between these types. Type 'unknown' is not assignable to type 'PoorMansUnknown'. Type 'unknown' is not assignable to type '{}'. TS2322 24 | component={withAuth( 25 | ({ match, history }: RouteComponentProps<{ chatId: string }>) => ( 26 | <ChatRoomScreen chatId={match.params.chatId} history={history} /> | ^ 27 | ) 28 | )} 29 | />
This error occurred during the build time and cannot be dismissed.
@Urigo check this report for me?
@igormenin @Urigo Same issue for me. Let me know here if you find a solution.
@igormenin : The temporary fix I made to be able to get rid of the error is to modify the file in the node_modules.
Goto node_modules/@types/history/index.d.ts and added "unknown" in line 49 as another option.
type PoorMansUnknown = {} | null | undefined | unknown;
I am not sure how to implement this as a pull request and where to file it. @Urigo
import History from 'history';
will result to this issue. History is a named export and hence import { History } from 'history';
is the correct way to go.
Hope this solves your issue ; - ) @igormenin @derek07 @eibay