I have the React type definition file (that is declared using an external module). In my source files, I usually do:
import * as R from \"react\"
The declare
keyword does not declare a variable in the global scope. This keyword is used for cases in which there will be a variable in the global scope and you want to use it in a TypeScript without getting compilation errors.
You can declare a global variable with:
import * as R from "react";
window.R = R;