Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

aiktb
Copy link
Contributor

@aiktb aiktb commented Sep 13, 2025

I always use "exactOptionalPropertyTypes": true, in TypeScript, so authToken? string and authToken?: string | undefined; are not equivalent. In short, the former type will cause the following code to have a TypeScript error:

  vite: () => ({
    plugins: [
      sentryVitePlugin({
        authToken: undefined,
      }),
    ],
  }),

Like this:
image

Updates type definition for optional property to include explicit undefined,
improving clarity and consistency in type annotations.
@Copilot Copilot AI review requested due to automatic review settings September 13, 2025 10:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR clarifies the type definition for the authToken property by making the undefined type explicit in the union type.

  • Updated the authToken property type from optional to explicitly include undefined in the union type

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

packages/bundler-plugin-core/src/types.ts Show resolved Hide resolved
@aiktb
Copy link
Contributor Author

aiktb commented Sep 18, 2025

Why is the test failing? It doesn't seem to be related to my commit.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Hey @aiktb sorry for the delayed review! I think this is a reasonable change and not API-breaking (as for a conventional TS setup nothing changes and for TS setups with explicit undefined, we only widen the type). So let's get this merged in.

I reran your tests but if it fails again would you mind rebasing to the latest main branch? Most likely this is some kind of test flake. EDIT: looks like this fails consistently and you're already on the currently latest main branch commit. Thing is, your change can't reasonably cause this so my next guess would be that this is happening in this PR because you're an external contributor.

(Fully aware that ideally we should apply this to all optional options but I don't have the bandwidth for this at the moment. If you or anyone else wants to have the same type change for other optional properties, feel free to open a PR).

@Lms24
Copy link
Member

Lms24 commented Oct 9, 2025

I'm gonna merge this and optimistically hope that this passes on main. Otherwise we need to figure something out 😅

@Lms24 Lms24 merged commit 73787df into getsentry:main Oct 9, 2025
34 of 40 checks passed
@Lms24 Lms24 changed the title chore(type): clarifies optional type with explicit undefined feat(core): Explicitly allow undefined as value for authToken option Oct 9, 2025
Lms24 added a commit that referenced this pull request Oct 9, 2025
Lms24 added a commit that referenced this pull request Oct 9, 2025
Lms24 added a commit that referenced this pull request Oct 10, 2025
* Revert "feat(core): Explicitly allow `undefined` as value for `authToken` option (#805)"

This reverts commit 73787df.

* Revert "Revert "feat(core): Explicitly allow `undefined` as value for `authToken` option (#805)""

This reverts commit 4ac2dc2.

* some debug logging

* .

* ..

* ...

* ....

* use posix?

* try rollup w/ posix

* move input file into rollup dir

* check and add

* wtf

* more logging

* so __dirname is the problem?

* try w/o __dirname

* fileURLToPath

* simplify

* avoid posix

* use move bundle.js into webpack dir

* use basename

* dirname, not basename

* start ci?

* delete per-dir bundle.js, use fileUrlToPath everywhere
@Lms24
Copy link
Member

Lms24 commented Oct 10, 2025

Tests were fixed via #807 (the reason they failed here is that they should have failed in general but for some reason didn't do so. I suspect the Nx cache to be responsible. Will investigate further)

renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Oct 11, 2025
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 4.3.0 | 4.4.0 |


## [v4.4.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#440)

- feat(core): Explicitly allow `undefined` as value for `authToken` option ([#805](getsentry/sentry-javascript-bundler-plugins#805))
- fix(core): Strip query strings from asset paths ([#806](getsentry/sentry-javascript-bundler-plugins#806))

Work in this release was contributed by [@aiktb](https://github.com/aiktb). Thank you for your contribution!
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Oct 11, 2025
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 4.3.0 | 4.4.0 |


## [v4.4.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#440)

- feat(core): Explicitly allow `undefined` as value for `authToken` option ([#805](getsentry/sentry-javascript-bundler-plugins#805))
- fix(core): Strip query strings from asset paths ([#806](getsentry/sentry-javascript-bundler-plugins#806))

Work in this release was contributed by [@aiktb](https://github.com/aiktb). Thank you for your contribution!
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.