Skip to content

Commit

Permalink
chore!: update typescript to version 5.0.4 (open-telemetry#5145)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
  • Loading branch information
david-luna and pichlermarc authored Jan 9, 2025
1 parent 643f2bb commit fddcd19
Show file tree
Hide file tree
Showing 75 changed files with 1,170 additions and 381 deletions.
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:
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 @@ -26,6 +26,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.

### 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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ 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.

OpenTelemetry JavaScript will follows DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window) which sets a support window of 2 years. Support for TypeScript versions older than 2 years will be dropped in minor releases of OpenTelemetry JavaScript.

## 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": "^5.2.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
2 changes: 1 addition & 1 deletion experimental/packages/exporter-logs-otlp-grpc/package.json
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
2 changes: 1 addition & 1 deletion experimental/packages/exporter-logs-otlp-http/package.json
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"
},
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"
},
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"
},
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"
},
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"
},
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"
},
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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,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 @@ -65,7 +65,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 @@ -68,7 +68,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"
},
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"
},
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/opentelemetry-sdk-node/package.json
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"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node",
"sideEffects": false
Expand Down
Loading

0 comments on commit fddcd19

Please sign in to comment.