Skip to content

Commit

Permalink
[🔥AUDIT🔥] [rg.audit.2] Add flowgen type defs (#618)
Browse files Browse the repository at this point in the history
🖍 _This is an audit!_ 🖍

## Summary:
Added flowgen.d.ts to fix typecheck.

Issue: FEI-4960

## Test plan:
`yarn typecheck`

Author: somewhatabstract

Auditors: #typescript, #frontend-infra

Required Reviewers:

Approved By:

Checks: ⌛ Lint, typecheck, and coverage check (ubuntu-latest, 16.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 16.x), ✅ gerald, ⏭  dependabot, ⌛ Analyze (javascript)

Pull Request URL: #618
  • Loading branch information
somewhatabstract authored Apr 3, 2023
1 parent 0299cc9 commit 47f9756
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changeset/breezy-baboons-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
39 changes: 39 additions & 0 deletions build-settings/flowgen.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Adapted from https://github.com/joarwilk/flowgen/blob/master/index.js.flow

declare module "flowgen" {
export type Options = {
jsdoc?: boolean;
interfaceRecords?: boolean;
moduleExports?: boolean;
quiet?: boolean;
inexact?: boolean;
};

export type Compiler = {
compileTest(path: string, target: string): void;
compileDefinitionString(
string: string,
options?: Options,
mapSourceCode?: (
source: string | void,
fileName: string,
) => string | void,
): string;
compileDefinitionFile(
path: string,
options?: Options,
mapSourceCode?: (
source: string | void,
fileName: string,
) => string | void,
): string;

// Low-level exports
reset(options?: Options): void;
setChecker(checker: any /* ts.TypeChecker */): void;
compile(sourceFile: any /* ts.SourceFile */): string;
};

export function beautify(str: string): string;
export const compiler: Compiler;
}

0 comments on commit 47f9756

Please sign in to comment.