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(remix-server-runtime): fix ServerBuild compatibility with exactOptionalPropertyTypes TS setting #5467

Closed
wants to merge 12 commits into from

Conversation

aaronadamsCA
Copy link
Contributor

Closes: #5466

  • Docs
  • Tests

Testing Strategy: None - I don't think there are currently any tests for this, and it's a very minor compat change, whereas new tests would be a much larger change.

@changeset-bot
Copy link

changeset-bot bot commented Feb 15, 2023

🦋 Changeset detected

Latest commit: c8a9a7a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@remix-run/server-runtime Patch
@remix-run/cloudflare Patch
@remix-run/deno Patch
@remix-run/dev Patch
@remix-run/node Patch
@remix-run/react Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
create-remix Patch
@remix-run/architect Patch
@remix-run/express Patch
@remix-run/netlify Patch
@remix-run/serve Patch
@remix-run/testing Patch
@remix-run/vercel Patch
remix Patch
@remix-run/css-bundle Patch
@remix-run/eslint-config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 15, 2023

Hi @aaronadamsCA,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Feb 15, 2023

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@github-actions
Copy link
Contributor

This PR has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this PR will be automatically closed.

@github-actions github-actions bot added the needs-response We need a response from the original author about this issue/PR label Apr 17, 2023
@MichaelDeBoey MichaelDeBoey changed the title Fix ServerBuild exact optional property type fix(remix-server-runtime): fix ServerBuild compatibility with exactOptionalPropertyTypes TS setting Apr 17, 2023
Copy link
Member

@MichaelDeBoey MichaelDeBoey left a comment

Choose a reason for hiding this comment

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

@aaronadamsCA I guess this would not be the only place we have an optional property, so we should probably update some other types as well in that case

Don't know if this is something we want to do for all our types though 🤔
I once saw an ESLint enforcing this, but can't remember which one it was though 😕

.changeset/rude-beers-promise.md Outdated Show resolved Hide resolved
.changeset/rude-beers-promise.md Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the needs-response We need a response from the original author about this issue/PR label Apr 17, 2023
@MichaelDeBoey MichaelDeBoey changed the base branch from main to dev April 17, 2023 23:46
@aaronadamsCA
Copy link
Contributor Author

@aaronadamsCA I guess this would not be the only place we have an optional property, so we should probably update some other types as well in that case

Don't know if this is something we want to do for all our types though 🤔 I once saw an ESLint enforcing this, but can't remember which one it was though 😕

You really only need it where you have an optional pass-through. IMO they can be adjusted one at a time as/if people run into challenges.

@MichaelDeBoey
Copy link
Member

Hi @aaronadamsCA!

Are you still interested in getting this one merged?

If so, please rebase onto latest dev & resolve conflicts

@MichaelDeBoey MichaelDeBoey added the needs-response We need a response from the original author about this issue/PR label May 2, 2023
@aaronadamsCA
Copy link
Contributor Author

@MichaelDeBoey Done!

@github-actions github-actions bot removed the needs-response We need a response from the original author about this issue/PR label May 2, 2023
@brophdawg11
Copy link
Contributor

I'd like to get @pcattori's eyes on this since it's both TS and dev server related

@brophdawg11 brophdawg11 requested review from pcattori and removed request for brophdawg11 May 31, 2023 14:23
@@ -15,7 +15,7 @@ export interface ServerBuild {
publicPath: string;
assetsBuildDirectory: string;
future: FutureConfig;
dev?: { port: number };
Copy link
Contributor

Choose a reason for hiding this comment

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

The intention is to allow omission of dev, not to let it be explicitly set to undefined. From what I can tell, including | undefined is not the semantics we want here.

Where is dev getting set to undefined explicitly? I think a better solution would be to make sure its omitted there instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem originates here:

export const dev: ServerBuild["dev"] = undefined!;

Because ServerBuild["dev"] is an optional property, the type of dev must be widened to include undefined. You could change this type to NonNullable<ServerBuild["dev"]>, but that seems like it might be less correct than the current change.

@pcattori pcattori mentioned this pull request Jul 3, 2023
2 tasks
@pcattori
Copy link
Contributor

pcattori commented Jul 3, 2023

dev field has been removed in #6724 , obsoleting this PR

@pcattori pcattori closed this Jul 3, 2023
@aaronadamsCA aaronadamsCA deleted the patch-1 branch July 3, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type is not assignable to type ServerBuild with exactOptionalPropertyTypes: true
5 participants