Unshare global types
Summary: This diff adds `types` fields on the compiler config for every project. This way we can make sure that for example node types and packages are not available in flipper-ui-core. Without an explicit types field, all types would be shared between all packages, and implicitly included into the compilation of everything. For the same reason `types/index.d.ts` has been removed, we want to be intentional on which types are being used in which package. This diff does most of the work, the next diff will fine tune the globals, and do some further cleanup. As an alternative solution I first tried a `nohoist: **/node_modules/types/**` and make sure every package list explicitly the types used in package json, which works but is much more error prone, as for example two different react types versions in two packages will cause the most unreadable compiler error due to the types not being shared and not literally the same. Reviewed By: lawrencelomax Differential Revision: D33124441 fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
af3757dcae
commit
5df34a337c
@@ -14,6 +14,7 @@ import {createFlipperServer} from './flipperServerConnection';
|
||||
document.getElementById('root')!.innerText = 'flipper-ui-browser started';
|
||||
|
||||
async function start() {
|
||||
// @ts-ignore
|
||||
(global as any).electronRequire = function (path: string) {
|
||||
console.error(
|
||||
`[decapitate] Tried to electronRequire ${path}, this module is not available in the browser and will be stubbed`,
|
||||
@@ -39,6 +40,7 @@ async function start() {
|
||||
// but not set yet, which might happen when using normal imports.
|
||||
// TODO: remove
|
||||
window.flipperShowError?.('Connected to Flipper Server successfully');
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line import/no-commonjs
|
||||
require('flipper-ui-core').startFlipperDesktop(flipperServer);
|
||||
window.flipperHideError?.();
|
||||
|
||||
Reference in New Issue
Block a user