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

build: Update typescript from 3.8.3 to 4.9.5 #8255

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,9 @@ jobs:
yarn test:package

job_node_integration_tests:
name: Node (${{ matrix.node }}) Integration Tests
name:
Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
Tests
needs: [job_get_metadata, job_build]
if: needs.job_get_metadata.outputs.changed_node == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
Expand All @@ -664,6 +666,12 @@ jobs:
fail-fast: false
matrix:
node: [10, 12, 14, 16, 18, 20]
typescript:
- false
include:
# Only check typescript for latest version (to streamline CI)
- node: 20
typescript: '3.8'
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v3
Expand All @@ -677,6 +685,11 @@ jobs:
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Overwrite typescript version
if: matrix.typescript
run: yarn add --dev --ignore-workspace-root-check typescript@${{ matrix.typescript }}

- name: Run integration tests
env:
NODE_VERSION: ${{ matrix.node }}
Expand Down Expand Up @@ -717,7 +730,7 @@ jobs:
yarn test:integration:ci

job_e2e_tests:
name: E2E Tests (Shard ${{ matrix.shard }})
name: E2E (Shard ${{ matrix.shard }}) Tests
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
# Dependabot PRs sadly also don't have access to secrets, so we skip them as well
if:
Expand All @@ -730,6 +743,7 @@ jobs:
fail-fast: false
matrix:
shard: [1, 2, 3]

steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v3
Expand All @@ -746,6 +760,7 @@ jobs:
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Get node version
id: versions
run: |
Expand Down
4 changes: 3 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
],
"outputs": [
"{projectRoot}/build/types",
"{projectRoot}/build/npm/types"
"{projectRoot}/build/types-ts3.8",
"{projectRoot}/build/npm/types",
"{projectRoot}/build/npm/types-ts3.8"
]
},
"lint:eslint": {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"chai": "^4.1.2",
"codecov": "^3.6.5",
"deepmerge": "^4.2.2",
"downlevel-dts": "~0.11.0",
"es-check": "7.1.0",
"eslint": "7.32.0",
"jest": "^27.5.1",
Expand All @@ -114,9 +115,9 @@
"size-limit": "^4.5.5",
"ts-jest": "^27.1.4",
"ts-node": "10.9.1",
"tslib": "^2.3.1",
"tslib": "2.4.1",
"typedoc": "^0.18.0",
"typescript": "3.8.3",
"typescript": "4.9.5",
"vitest": "^0.29.2",
"yalc": "^1.0.0-pre.53"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/angular-ivy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@sentry/browser": "7.56.0",
"@sentry/types": "7.56.0",
"@sentry/utils": "7.56.0",
"tslib": "^2.3.0"
"tslib": "^2.4.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.18",
Expand All @@ -37,7 +37,6 @@
"@angular/platform-browser-dynamic": "~12.2.0",
"@angular/router": "~12.2.0",
"ng-packagr": "^12.1.1",
"typescript": "~4.3.5",
Lms24 marked this conversation as resolved.
Show resolved Hide resolved
"zone.js": "~0.11.4"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@sentry/browser": "7.56.0",
"@sentry/types": "7.56.0",
"@sentry/utils": "7.56.0",
"tslib": "^2.0.0"
"tslib": "^2.4.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1002.4",
Expand All @@ -38,7 +38,7 @@
"@angular/router": "~10.2.5",
"ng-packagr": "^10.1.0",
"rxjs": "6.5.5",
"typescript": "~4.0.2",
"typescript": "4.0.2",
Lms24 marked this conversation as resolved.
Show resolved Hide resolved
"zone.js": "^0.11.8"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/src/errorhandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import type { ErrorHandler as AngularErrorHandler } from '@angular/core';
import { Inject, Injectable } from '@angular/core';
import * as Sentry from '@sentry/browser';
import { captureException } from '@sentry/browser';
import type { Event, Scope } from '@sentry/types';
import { addExceptionMechanism, isString } from '@sentry/utils';

import { runOutsideAngular } from './zone';
Expand Down Expand Up @@ -101,7 +101,7 @@ class SentryErrorHandler implements AngularErrorHandler {

// Capture handled exception and send it to Sentry.
const eventId = runOutsideAngular(() =>
captureException(extractedError, scope => {
Sentry.captureException(extractedError, (scope: Scope) => {
scope.addEventProcessor(event => {
addExceptionMechanism(event, {
type: 'angular',
Expand All @@ -126,7 +126,7 @@ class SentryErrorHandler implements AngularErrorHandler {
const client = Sentry.getCurrentHub().getClient();

if (client && client.on && !this._registeredAfterSendEventHandler) {
client.on('afterSendEvent', event => {
client.on('afterSendEvent', (event: Event) => {
if (!event.type) {
Sentry.showReportDialog({ ...this._options.dialogOptions, eventId: event.event_id });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/test/errorhandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('SentryErrorHandler', () => {
describe('handleError method', () => {
it('handleError method assigns the correct mechanism', () => {
const addEventProcessorSpy = jest.spyOn(FakeScope, 'addEventProcessor').mockImplementationOnce(callback => {
void callback({}, { event_id: 'fake-event-id' });
void (callback as (event: any, hint: any) => void)({}, { event_id: 'fake-event-id' });
return FakeScope;
});

Expand Down
1 change: 0 additions & 1 deletion packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"html-webpack-plugin": "^5.5.0",
"pako": "^2.1.0",
"playwright": "^1.31.1",
"typescript": "^4.5.2",
"webpack": "^5.52.0"
},
"devDependencies": {
Expand Down
9 changes: 7 additions & 2 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"main": "build/npm/cjs/index.js",
"module": "build/npm/esm/index.js",
"types": "build/npm/types/index.d.ts",
"typesVersions": {
"<4.9": { "build/npm/types/index.d.ts": ["build/npm/types-ts3.8/index.d.ts"] }
},
"publishConfig": {
"access": "public"
},
Expand All @@ -21,7 +24,7 @@
"@sentry/replay": "7.56.0",
"@sentry/types": "7.56.0",
"@sentry/utils": "7.56.0",
"tslib": "^1.9.3"
"tslib": "^2.4.1 || ^1.9.3"
Lms24 marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@sentry-internal/integration-shims": "7.56.0",
Expand Down Expand Up @@ -53,7 +56,9 @@
"build:bundle:es5": "JS_VERSION=es5 rollup -c rollup.bundle.config.js",
"build:bundle:es6": "JS_VERSION=es6 rollup -c rollup.bundle.config.js",
"build:transpile": "rollup -c rollup.npm.config.js",
"build:types": "tsc -p tsconfig.types.json",
"build:types": "run-s build:types:core build:types:downlevel",
"build:types:core": "tsc -p tsconfig.types.json",
"build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8",
"build:watch": "run-p build:transpile:watch build:bundle:watch build:types:watch",
"build:dev:watch": "yarn build:watch",
"build:bundle:watch": "rollup -c rollup.bundle.config.js --watch",
Expand Down
3 changes: 2 additions & 1 deletion packages/browser/src/eventbuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export function eventFromUnknownInput(
// https://developer.mozilla.org/en-US/docs/Web/API/DOMError
// https://developer.mozilla.org/en-US/docs/Web/API/DOMException
// https://webidl.spec.whatwg.org/#es-DOMException-specialness
if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {
if (isDOMError(exception) || isDOMException(exception as DOMException)) {
const domException = exception as DOMException;

if ('stack' in (exception as Error)) {
Expand All @@ -220,6 +220,7 @@ export function eventFromUnknownInput(
addExceptionTypeValue(event, message);
}
if ('code' in domException) {
// eslint-disable-next-line deprecation/deprecation
event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };
}

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/integrations/breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,5 @@ function _historyBreadcrumb(handlerData: HandlerData & { from: string; to: strin
}

function _isEvent(event: unknown): event is Event {
return event && !!(event as Record<string, unknown>).target;
return !!event && !!(event as Record<string, unknown>).target;
}
2 changes: 1 addition & 1 deletion packages/browser/test/unit/integrations/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('internal wrap()', () => {
try {
wrapped();
} catch (error) {
expect(error.message).toBe('boom');
expect((error as Error).message).toBe('boom');
}
});

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/test/unit/transports/offline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const createTestTransport = (...sendResults: MockResult<TransportMakeRequ
reject(next);
} else {
sendCount += 1;
resolve(next as TransportMakeRequestResponse | undefined);
resolve(next as TransportMakeRequestResponse);
}
});
}),
Expand Down
9 changes: 7 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,24 @@
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/types/index.d.ts",
"typesVersions": {
"<4.9": { "build/types/index.d.ts": ["build/types-ts3.8/index.d.ts"] }
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@sentry/types": "7.56.0",
"@sentry/utils": "7.56.0",
"tslib": "^1.9.3"
"tslib": "^2.4.1 || ^1.9.3"
},
"scripts": {
"build": "run-p build:transpile build:types",
"build:dev": "yarn build",
"build:transpile": "rollup -c rollup.npm.config.js",
"build:types": "tsc -p tsconfig.types.json",
"build:types": "run-s build:types:core build:types:downlevel",
"build:types:core": "tsc -p tsconfig.types.json",
"build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8",
"build:watch": "run-p build:transpile:watch build:types:watch",
"build:dev:watch": "yarn build:watch",
"build:transpile:watch": "rollup -c rollup.npm.config.js --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/transports/offline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ export function makeOfflineTransport<TO>(
retryDelay = START_DELAY;
return result;
} catch (e) {
if (store && (await shouldQueue(envelope, e, retryDelay))) {
if (store && (await shouldQueue(envelope, e as Error, retryDelay))) {
Lms24 marked this conversation as resolved.
Show resolved Hide resolved
await store.insert(envelope);
flushWithBackOff();
log('Error sending. Event queued', e);
log('Error sending. Event queued', e as Error);
return {};
} else {
throw e;
Expand Down
1 change: 1 addition & 0 deletions packages/core/test/lib/hint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('Hint', () => {

afterEach(() => {
jest.clearAllMocks();
// @ts-ignore for testing
delete GLOBAL_OBJ.__SENTRY__;
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/lib/transports/offline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const createTestTransport = (
reject(next);
} else {
sendCount += 1;
resolve(next as TransportMakeRequestResponse | undefined);
resolve(next as TransportMakeRequestResponse);
}
});
}),
Expand Down
1 change: 0 additions & 1 deletion packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"fs-extra": "11.1.0",
"glob": "8.0.3",
"ts-node": "10.9.1",
"typescript": "3.8.3",
"yaml": "2.2.2"
},
"volta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"next": "13.0.7",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.4"
"typescript": "4.9.5"
},
"devDependencies": {
"@playwright/test": "^1.27.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scripts": "5.0.1",
"typescript": "4.4.2",
"typescript": "4.9.5",
"web-vitals": "2.1.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
"testApplicationName": "create-react-app",
"buildCommand": "pnpm install && pnpm build",
"tests": [],
"versions": [
{
"dependencyOverrides": {
"typescript": "3.8.3"
}
}
],
"canaryVersions": [
{
"dependencyOverrides": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.4",
"typescript": "4.9.5",
"wait-port": "1.0.4",
"ts-node": "10.9.1",
"@playwright/test": "^1.27.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-dom": "18.2.0",
"react-router-dom": "^6.4.1",
"react-scripts": "5.0.1",
"typescript": "4.4.2",
"typescript": "4.9.5",
"web-vitals": "2.1.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"react-dom": "18.2.0",
"react-router-dom": "^6.4.1",
"react-scripts": "5.0.1",
"typescript": "4.4.2",
"typescript": "4.9.5",
"web-vitals": "2.1.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"testCommand": "pnpm test"
}
],
"versions": [
{
"dependencyOverrides": {
"typescript": "3.8.3"
}
}
],
"canaryVersions": [
{
"dependencyOverrides": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"ts-node": "10.9.1",
"tslib": "^2.4.1",
"tslib": "2.4.1",
"typescript": "^5.0.0",
"vite": "^4.2.0",
"wait-port": "1.0.4"
Expand Down
1 change: 0 additions & 1 deletion packages/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"loader.js": "~4.7.0",
"qunit": "~2.19.2",
"qunit-dom": "~2.0.0",
"typescript": "~4.5.2",
"webpack": "~5.74.0"
},
"engines": {
Expand Down
Loading