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

chore: enhance types for base-command.ts #6261

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

lukasholzer
Copy link
Contributor

🎉 Thanks for submitting a pull request! 🎉

Summary

To not have my change and the types refactoring in one PR this is just the PR for the types refactorings.

The actual change will come in a follow-up.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@lukasholzer lukasholzer requested a review from a team as a code owner December 12, 2023 11:22
Copy link

📊 Benchmark results

Comparing with 3f37b8e

  • Dependency count: 1,399 (no change)
  • Package size: 405 MB (no change)
  • Number of ts-expect-error directives: 1,292 ⬇️ 3.02% decrease vs. 3f37b8e

export const getPluginsToAutoInstall = (pluginsInstalled = [], pluginsRecommended = []) =>
pluginsRecommended.reduce(
export const getPluginsToAutoInstall = (
command: BaseCommand,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this parameter used anywhere - am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope it is a prerequisite for the follow up PR just forgot to remove it from this one. In the follow up I need to access the feature flags from the base command.

/** @private */
noBaseOptions = false

#noBaseOptions = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not use private noBaseOptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript private is not a JavaScript private this is truly private and not accessible after transpiling.

TBH I would prefer this notation over using they private keyword as this is just dropped on transpiling

Copy link
Member

@eduardoboucas eduardoboucas Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care if it's truly private or not, though? This is not a public interface we're exposing to user code. I think we should focus on code readability and type safety, and having to prefix every private property with # feels a bit awkward and noisy to me, personally.

@@ -613,7 +548,8 @@ export default class BaseCommand extends Command {
certificateFile: flags.httpProxyCertificateFilename,
})
const apiOpts = { ...apiUrlOpts, agent }
const api = new NetlifyAPI(token || '', apiOpts)
// TODO: remove typecast once we have proper types for the API
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏🏻

@lukasholzer lukasholzer merged commit d5fcdc5 into main Dec 12, 2023
35 checks passed
@lukasholzer lukasholzer deleted the chore/enahnce-types-for-base-command branch December 12, 2023 11:54
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.

3 participants