Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix types of core getConfig #8362

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

tanishqkancharla
Copy link
Contributor

↪️ 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)
  • Included links to related issues/PRs

@devongovett devongovett merged commit 96d8f28 into parcel-bundler:v2 Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants