Produce tsc typings for "flipper" package
Summary: This diffs refactors tsc projects structure and structure of our custom typings to allow producing typescript typings for "flipper" package. In next diffs I'm going to use the produced typings to check compatibility of plugins with certain versions of Flipper, e.g. to check whether plugin is compatible with current "stable" and "insiders" version. Reviewed By: passy Differential Revision: D26997158 fbshipit-source-id: a0416c7139bf08ec9d175730da4c4c2a8768eeb7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
779e89db1d
commit
f468f0e07d
51
desktop/types/ResizeObserver.d.ts
vendored
51
desktop/types/ResizeObserver.d.ts
vendored
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export interface ResizeObserver {
|
||||
new (callback: ResizeObserverCallback): ResizeObserver;
|
||||
observe: (target: Element) => void;
|
||||
unobserve: (target: Element) => void;
|
||||
disconnect: () => void;
|
||||
}
|
||||
|
||||
interface ResizeObserverCallback {
|
||||
(entries: ResizeObserverEntry[], observer: ResizeObserver): void;
|
||||
}
|
||||
|
||||
export interface ResizeObserverEntry {
|
||||
/**
|
||||
* @param target The Element whose size has changed.
|
||||
*/
|
||||
new (target: Element): ResizeObserverEntry;
|
||||
|
||||
/**
|
||||
* The Element whose size has changed.
|
||||
*/
|
||||
readonly target: Element;
|
||||
|
||||
/**
|
||||
* Element's content rect when ResizeObserverCallback is invoked.
|
||||
*/
|
||||
readonly contentRect: DOMRectReadOnly;
|
||||
}
|
||||
|
||||
interface DOMRectReadOnly {
|
||||
// static fromRect(other: DOMRectInit | undefined): DOMRectReadOnly;
|
||||
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
readonly top: number;
|
||||
readonly right: number;
|
||||
readonly bottom: number;
|
||||
readonly left: number;
|
||||
|
||||
toJSON: () => any;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {StoreEnhancerStoreCreator} from 'redux';
|
||||
import {ResizeObserver} from './ResizeObserver.d';
|
||||
import {Store} from '../app/src/reducers';
|
||||
|
||||
export {};
|
||||
|
||||
declare global {
|
||||
interface StoreEnhancerStateSanitizer {
|
||||
stateSanitizer: Function;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
flipperGlobalStoreDispatch: Store['dispatch'];
|
||||
|
||||
__REDUX_DEVTOOLS_EXTENSION__:
|
||||
| undefined
|
||||
| (StoreEnhancerStoreCreator & StoreEnhancerStateSanitizer);
|
||||
|
||||
Flipper: {
|
||||
init: () => void;
|
||||
};
|
||||
|
||||
ResizeObserver: ResizeObserver;
|
||||
}
|
||||
}
|
||||
29
desktop/types/index.d.ts
vendored
Normal file
29
desktop/types/index.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
/// <reference path="JSONStream.d.ts" />
|
||||
/// <reference path="ReactDebounceRender.d.ts" />
|
||||
/// <reference path="XmlBeautifier.d.ts" />
|
||||
/// <reference path="adbkit-logcat.d.ts" />
|
||||
/// <reference path="adbkit.d.ts" />
|
||||
/// <reference path="ansi-to-html.d.ts" />
|
||||
/// <reference path="decompress-targz.d.ts" />
|
||||
/// <reference path="decompress-unzip.d.ts" />
|
||||
/// <reference path="download-tarball.d.ts" />
|
||||
/// <reference path="json-format-highlight.d.ts" />
|
||||
/// <reference path="line-replace.d.ts" />
|
||||
/// <reference path="live-plugin-manager.d.ts" />
|
||||
/// <reference path="memoize-weak.d.ts" />
|
||||
/// <reference path="metro-cache.d.ts" />
|
||||
/// <reference path="metro-resolver.d.ts" />
|
||||
/// <reference path="metro.d.ts" />
|
||||
/// <reference path="nodejs.d.ts" />
|
||||
/// <reference path="npm-api.d.ts" />
|
||||
/// <reference path="openssl-wrapper.d.ts" />
|
||||
/// <reference path="string-natural-compare.d.ts" />
|
||||
16
desktop/types/memoize-weak.d.ts
vendored
Normal file
16
desktop/types/memoize-weak.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
declare module 'memoize-weak' {
|
||||
export default function memoize<T extends (...args: any) => any>(
|
||||
fn: T,
|
||||
): T & {
|
||||
clear(...args: Parameters<T> | []): void;
|
||||
};
|
||||
}
|
||||
17
desktop/types/package.json
Normal file
17
desktop/types/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@types/flipper-custom-typings",
|
||||
"version": "0.0.0",
|
||||
"private": "true",
|
||||
"description": "Custom typings for untyped Flipper dependencies",
|
||||
"repository": "facebook/flipper",
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/facebook/flipper/issues",
|
||||
"homepage": "https://github.com/facebook/flipper",
|
||||
"keywords": [
|
||||
"Flipper"
|
||||
],
|
||||
"author": "Facebook, Inc",
|
||||
"scripts": {
|
||||
"postinstall": "../ts-node ../scripts/gen-type-index.ts"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user