core icon indicating copy to clipboard operation
core copied to clipboard

Build failure with `exactOptionalPropertyTypes` enabled

Open jhasuraj01 opened this issue 4 months ago • 5 comments

Is your feature request related to a problem? Please describe.

Building the project using this library fails when exactOptionalPropertyTypes is enabled in project's tsconfig.json unless skipLibCheck is also set to true. skipLibCheck bypasses type checking for third-party libraries, compromising type safety.

Describe the solution you'd like

  • Add the exactOptionalPropertyTypes property to oclif/core's tsconfig.json.
  • Make any necessary code changes to ensure successful build with this option enabled.

Example rc/config/plugin.ts#L85:

From To
{ 
    parent: Plugin | undefined;    
}
{
    parent?: Plugin;
}

Additional context

  • This change will improve type safety, leading to fewer potential runtime errors.
  • It demonstrates adherence to best practices for TypeScript projects.

I would be happy to come up with a PR or collaborate on a potential solution.

jhasuraj01 avatar Feb 17 '24 20:02 jhasuraj01