Skip to content

Update Packages#1337

Merged
fadi-george merged 4 commits intomainfrom
fg/update-packages
Jul 25, 2025
Merged

Update Packages#1337
fadi-george merged 4 commits intomainfrom
fg/update-packages

Conversation

@fadi-george
Copy link
Copy Markdown
Contributor

@fadi-george fadi-george commented Jul 24, 2025

Description

1 Line Summary

Update vite packages and use recommend tsconfig settings.

Details

  • Updates vite packages and some testing packages (msw, jsdom, etc.) to latest version
  • Updates our tsconfig settings with erasableSyntaxOnly to discourage use of enums and other things in the app
  • Updates the tsconfig settings to have verbatimModuleSyntax to force import type when importing interfaces e.g.
// E.g. this would give you a warning
import axios, { AxiosInstance, AxiosResponse } from "axios"

// but this is fine:
import axios, { type AxiosInstance, type AxiosResponse } from "axios"

// or if its all just types then you can
import type { TypeA, TypeB, ... } from 'types/...'

Systems Affected

  • WebSDK
  • Backend
  • Dashboard

Validation

Tests

Info

Checklist

  • All the automated tests pass or I explained why that is not possible
  • I have personally tested this on my machine or explained why that is not possible
  • I have included test coverage for these changes or explained why they are not needed

Programming Checklist
Interfaces:

  • Don't use default export
  • New interfaces are in model files

Functions:

  • Don't use default export
  • All function signatures have return types
  • Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • No Typescript warnings
  • Avoid silencing null/undefined warnings with the exclamation point

Other:

  • Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Checklist

  • I have included screenshots/recordings of the intended results or explained why they are not needed

Related Tickets



This change is Reviewable

@fadi-george fadi-george requested a review from sherwinski July 24, 2025 21:15
Comment thread tsconfig.json
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be good to include notes (in the PR description) on the motivation to use this flag vs isoladedModules e.g. how does it specific benefit developer experience, bundle size, etc. There are some comparisons in this reference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Saves a little of space by not using enums. And import type helps to different real classes from typescript types/interfaces.

Comment thread tsconfig.json Outdated
Comment thread tsconfig.json
"target": "ES2020",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ESNext", "DOM", "DOM.Iterable", "WebWorker"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why the choice to remove WebWorker here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I still have it.

Comment on lines +39 to +40
await OneSignal.User.addTags(finalTagsObject);
return finalTagsObject;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are these two functionally the same?

return (await OneSignal.User.addTags(
        finalTagsObject, 
      )) as TagsObjectForApi;

Copy link
Copy Markdown
Contributor Author

@fadi-george fadi-george Jul 25, 2025

Choose a reason for hiding this comment

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

AddTags doesnt return anything but the outer function (sendTags) has this Promise<TagsObjectForApi>.

@fadi-george fadi-george requested a review from sherwinski July 25, 2025 00:33
@fadi-george fadi-george merged commit dc115bd into main Jul 25, 2025
4 checks passed
@fadi-george fadi-george deleted the fg/update-packages branch July 25, 2025 17:18
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