parcel
parcel copied to clipboard
Fix types of core `getConfig`
βͺοΈ Pull Request
Previously getConfig
was typed in flow as:
getConfig<T>(
filePaths: Array<FilePath>,
options: ?{|
packageKey?: string,
parse?: boolean,
exclude?: boolean,
|},
): Promise<?ConfigResultWithFilePath<T>>;
This generates the ts type definition
getConfig<WebsiteContext>(filePaths: string[], options: {
packageKey?: string | undefined;
parse?: boolean | undefined;
exclude?: boolean | undefined;
} | null | undefined): Promise<β¦>
Unfortunately, this means the second argument is required in typescript when itβs really not. This PR makes it so the corresponding type definitions of typescript mark the argument as optional.
π» Examples
N/A
π¨ Test instructions
Run npm run build-ts
and see if the output correctly generates optional types for getConfig
and getConfigFrom
.
βοΈ PR Todo
- [-] Added/updated unit tests for this change
- [-] Filled out test instructions (In case there aren't any unit tests)
- [x] Included links to related issues/PRs