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

chore!: update typescript to version 5.0.4 #5145

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f0933b9
chore: update typescript and ts-node dependencies
david-luna Nov 12, 2024
8d8ea7c
chore: transpile only for tests
david-luna Nov 12, 2024
08d14f7
chore: bump mocha types
david-luna Nov 12, 2024
73422ec
chore: remove api-test-eol workflow
david-luna Nov 12, 2024
40d4587
chore: update typescript on missing packages
david-luna Nov 14, 2024
8f4220c
chore: merge upstream/next
david-luna Nov 14, 2024
0695015
chore: update changelog
david-luna Nov 14, 2024
1db53a3
chore: pin typescript version
david-luna Nov 15, 2024
7dfbae7
chore: update TS mode resolution to nodenext
david-luna Nov 15, 2024
780830e
chore: rever module resolution
david-luna Nov 15, 2024
268bf92
chore: update docs
david-luna Nov 18, 2024
6fe7953
chore: update docs
david-luna Nov 18, 2024
87f231f
chore: revert change in tsconfig
david-luna Nov 18, 2024
703f0ab
chore: update value for tsconfig compiler options
david-luna Nov 18, 2024
c46c11b
Merge branch 'next' into next-update-typescript
david-luna Nov 25, 2024
7d71e92
chore: update changelog
david-luna Nov 27, 2024
8ce75a9
Merge branch 'next' into next-update-typescript
david-luna Dec 2, 2024
8eca42c
chore: set typescript version to 5.0.4
david-luna Dec 5, 2024
517790c
chore: update docs
david-luna Dec 5, 2024
04391c7
Merge branch 'next-update-typescript' of github.com:david-luna/opente…
david-luna Dec 5, 2024
8b6e408
chore: fix lint issues
david-luna Dec 5, 2024
af2f2b0
chore: merge next
david-luna Dec 9, 2024
9d74bb9
chore: sync package-lock.json
david-luna Dec 9, 2024
36c084c
chore: fix compilation error
david-luna Dec 9, 2024
7c5e895
chore: merge main
david-luna Dec 19, 2024
920c2c3
chore: use nodenext as module compile option
david-luna Dec 19, 2024
bb7568d
chore: reset module resolution
david-luna Dec 19, 2024
d26fbd2
Merge branch 'main' into next-update-typescript
david-luna Dec 19, 2024
b7580fb
chore: reset module resolution is esm config
david-luna Dec 19, 2024
991280b
chore: set resolution to node16 & fix imports
david-luna Dec 19, 2024
a4e30a7
chore: rollback mocha config
david-luna Dec 19, 2024
e01cd50
chore: update readme
david-luna Dec 20, 2024
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
36 changes: 0 additions & 36 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,39 +134,3 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
api-eol-node-test:
Copy link
Contributor Author

@david-luna david-luna Nov 18, 2024

Choose a reason for hiding this comment

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

note for reviewer: TypeScript 5.0+ removes support for Node.js <=12.0

strategy:
fail-fast: false
matrix:
node_version:
- "8"
- "10"
- "12"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: |
package-lock.json
node-version: ${{ matrix.node_version }}

- name: Build
working-directory: ./api
run: |
npm install --ignore-scripts
npm install @types/mocha@^7 mocha@^7 ts-loader@^8
node ../scripts/version-update.js
npx tsc --build tsconfig.json tsconfig.esm.json

- name: Test
working-directory: ./api
# running test:eol as node 8 is not supported anymore by the version of nyc we use, as we don't report coverage
# for this step we leave it out.
# Details: nyc requires istanbul-lib-report, which silently dropped support for Node.js v8 when going from
# 3.0.0 to 3.0.1 by requiring make-dir@^4.0.0 to fix https://github.com/advisories/GHSA-c2qf-rxjj-qqgw.
# make-dir does not support Node.js v8 anymore.
run: npm run test:eol
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
* refactor(sdk-trace-base)!: remove `new Span` constructor in favor of `Tracer.startSpan` API [#5048](https://github.com/open-telemetry/opentelemetry-js/pull/5048) @david-luna
* refactor(sdk-trace-base)!: remove `BasicTracerProvider.addSpanProcessor` API in favor of constructor options. [#5134](https://github.com/open-telemetry/opentelemetry-js/pull/5134) @david-luna
* refactor(sdk-trace-base)!: make `resource` property private in `BasicTracerProvider` and remove `getActiveSpanProcessor` API. [#5192](https://github.com/open-telemetry/opentelemetry-js/pull/5192) @david-luna
* chore!: update typescript to version `5.0.4` [#5145](https://github.com/open-telemetry/opentelemetry-js/pull/5145) @david-luna
* (user-facing) dropped support for `typescript@<5.0.4`
* (user-facing) all packages published from this repository will from now on drop support for old versions of `typescript` in minor releases. We will only drop support for versions that are older than 2 years.

### :rocket: (Enhancement)

Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ cd packages/opentelemetry-module-name
npm run watch
```

#### TypeScript version & update policy

TypeScript version used to compile the pacakges is `v5.0.4`. If you plan to use any of the packages from this
repository to make your own application or package instrumentation make sure to use same version or higher.

<!-- Ref: https://github.com/open-telemetry/opentelemetry-js/pull/5145#issuecomment-2518263890 -->
As update policy OpenTelemetry JS will follow DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window)
which sets a support window of 2 years.

Comment on lines +206 to +214
Copy link
Member

Choose a reason for hiding this comment

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

It may be good to have this be more visible by also stating something similar in README.md - while it's important for contributors to know how we're using typescript, there's an effect on end-users that we should communicate. 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would be e01cd50 enough?

### Running tests

Similar to compilations, tests can be run from the root to run all tests or from a single module to run only the tests for that module.
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ environments. Any support issues that arise from using a browser or runtime that

This minimum support level is subject to change as the project evolves and as the underlying language features evolve.

## TypeScript Support

OpenTelemetry JavaScript is built with TypeScript `v5.0.4`. If you have a TypeScript project (app, library, instrumentation, etc.)
that depends on it we recomed using same or higher version to compile the project.

As update policy OpenTelemetry JavaScript will follow DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window)
which sets a support window of 2 years.

## Package Version Compatibility

OpenTelemetry is released as a set of distinct packages in 3 categories: API, stable SDK, and experimental.
Expand Down
3 changes: 1 addition & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"lint": "eslint . --ext .ts",
"test:browser": "karma start --single-run",
"test": "nyc mocha 'test/**/*.test.ts'",
"test:eol": "mocha 'test/**/*.test.ts'",
"test:webworker": "karma start karma.worker.js --single-run",
"cycle-check": "dpdm --exit-code circular:1 src/index.ts",
"version": "node ../scripts/version-update.js",
Expand Down Expand Up @@ -98,7 +97,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"unionfs": "4.5.4",
"webpack": "5.96.1"
},
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/diag/logLevel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('LogLevelFilter DiagLogger', () => {

const levelMap: Array<{
message: string;
level: DiagLogLevel;
level: number;
ignoreFuncs: Array<keyof DiagLogger>;
}> = [
{ message: 'ALL', level: DiagLogLevel.ALL, ignoreFuncs: [] },
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/diag/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import sinon = require('sinon');
import * as sinon from 'sinon';
import { diag, DiagLogLevel } from '../../../src';
import { createNoopDiagLogger } from '../../../src/diag/internal/noopLogger';
import { DiagLogger } from '../../../src/diag/types';
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/internal/global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

import * as assert from 'assert';
import * as sinon from 'sinon';
import { getGlobal } from '../../../src/internal/global-utils';
import { _globalThis } from '../../../src/platform';
import { NoopContextManager } from '../../../src/context/NoopContextManager';
import { DiagLogLevel } from '../../../src/diag/types';
import sinon = require('sinon');

const api1 = require('../../../src') as typeof import('../../../src');

Expand Down
2 changes: 1 addition & 1 deletion examples/opentelemetry-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@babel/preset-env": "^7.22.20",
"babel-loader": "^8.0.6",
"ts-loader": "^9.2.6",
"typescript": "^4.5.2",
"typescript": "5.0.4",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.5.0",
Expand Down
2 changes: 1 addition & 1 deletion experimental/backwards-compatibility/node14/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@types/node": "14.18.25",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion experimental/backwards-compatibility/node16/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@types/node": "16.11.52",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/api-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"mocha": "10.8.2",
"nyc": "15.1.0",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/api-events",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/api-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"mocha": "10.8.2",
"nyc": "15.1.0",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/api-logs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"mocha": "10.8.2",
"nyc": "15.1.0",
"sinon": "15.1.2",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ describe('fetch', () => {
const decoder = new TextDecoder();
requestBody = '';
const read = async () => {
// @ts-expect-error -- iterator symbol was removed from types
for await (const c of body) {
requestBody += decoder.decode(c);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"nyc": "15.1.0",
"semver": "7.6.3",
"sinon": "15.1.2",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"request-promise-native": "1.0.9",
"sinon": "15.1.2",
"superagent": "10.0.2",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import * as superagent from 'superagent';
// Temporarily removed. See https://github.com/open-telemetry/opentelemetry-js/issues/3344
// import * as got from 'got';
import * as nock from 'nock';
import axios, { AxiosResponse } from 'axios';
import * as axios from 'axios';

const memoryExporter = new InMemorySpanExporter();
const protocol = 'http';
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('Packages', () => {
);
const result = await httpPackage.get(urlparsed.href!);
if (!resHeaders) {
const res = result as AxiosResponse<unknown>;
const res = result as axios.AxiosResponse<unknown>;
resHeaders = res.headers as any;
}
const spans = memoryExporter.getFinishedSpans();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import * as superagent from 'superagent';
// Temporarily removed. See https://github.com/open-telemetry/opentelemetry-js/issues/3344
// import * as got from 'got';
import * as nock from 'nock';
import axios, { AxiosResponse } from 'axios';
import * as axios from 'axios';

const memoryExporter = new InMemorySpanExporter();
const customAttributeFunction = (span: Span): void => {
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('Packages', () => {
);
const result = await httpPackage.get(urlparsed.href!);
if (!resHeaders) {
const res = result as AxiosResponse<unknown>;
const res = result as axios.AxiosResponse<unknown>;
resHeaders = res.headers as any;
}
const spans = memoryExporter.getFinishedSpans();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH } from '@opentelemetry/semantic-c
import { ReadableSpan, SpanProcessor } from '@opentelemetry/sdk-trace-base';
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { XMLHttpRequestInstrumentation } from '../src';
import assert = require('assert');
import * as assert from 'assert';

class TestSpanProcessor implements SpanProcessor {
spans: ReadableSpan[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"nyc": "15.1.0",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4",
"typescript": "5.0.4",
"webpack": "5.96.1",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"semver": "7.6.3",
"sinon": "15.1.2",
"ts-loader": "9.5.1",
"typescript": "4.4.4"
"typescript": "5.0.4"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node",
"sideEffects": false
Expand Down
Loading
Loading