Skip to content

Commit 408008f

Browse files
DanielRosenwasserscttcper
authored andcommitted
chore(typescript): Switch to --moduleResolution bundler, remove duplicate properties, remove @ts-expect-error comments (#91686)
Related to #90413. In order to cleanly measure relative performance improvements in [the native port of the TypeScript compiler](https://github.com/microsoft/typescript-go), this change removes some errors found by compiling with tsgo. Specifically: - duplicate computed-name properties have been removed - unnecessary `@ts-expect-error` comments have been removed (thanks to new `moduleResolution` settings`) - deep imports into `@emotion/styled` have been replaced by updating an existing top-level import - module resolution has been updated to `bundler` because - `--moduleResolution node` a.k.a. `node10` will be deprecated in TypeScript 6.0 - `--moduleResolution nodenext` will not work because many existing paths in `import()` calls lack a file extension - in reality, most files are processed by a bundler down the line (or a runtime like ts-node that has bundler-like resolution mechanics) ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. --------- Co-authored-by: Scott Cooper <scttcper@gmail.com>
1 parent 5bebd2e commit 408008f

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

config/build-chartcuterie.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import fs from 'node:fs/promises';
66
import path from 'node:path';
77
import {fileURLToPath} from 'node:url';
88

9-
// @ts-expect-error need to switch tsconfig to use module: esnext or es2020
109
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
1110
const workspaceRoot = path.resolve(scriptDir, '..');
1211
const packageJsonPath = path.join(workspaceRoot, 'package.json');

config/tsconfig.base.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
//
1515
// [0]: https://babeljs.io/docs/en/babel-preset-typescript
1616
// [1]: https://node.green
17-
"module": "commonjs",
17+
"module": "preserve",
1818
"target": "ES2022",
19-
"moduleResolution": "node",
19+
"moduleResolution": "bundler",
2020

2121
// We add esnext to lib to pull in types for all newer ECMAScript features
2222
"lib": ["esnext", "dom", "dom.iterable"],
@@ -124,6 +124,13 @@
124124
"include": ["../static/app", "../static/gsApp", "../tests/js"],
125125
"exclude": ["../node_modules", "../**/*.benchmark.ts"],
126126
"ts-node": {
127-
"transpileOnly": true
127+
"transpileOnly": true,
128+
"compilerOptions": {
129+
// TODO: We should be able to use "node16" on next major version of jest
130+
// https://github.com/jestjs/jest/pull/14739
131+
"module": "commonjs",
132+
// TODO: node10 will be deprecated in typescript 6.0
133+
"moduleResolution": "node10"
134+
}
128135
}
129136
}

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ export default typescript.config([
169169
// https://typescript-eslint.io/packages/parser/#projectservice
170170
// `projectService` is recommended, but slower, with our current tsconfig files.
171171
projectService: true,
172-
// @ts-expect-error TS1343: The import.meta meta-property is only allowed when the --module option is es2020, es2022, esnext, system, node16, or nodenext
173172
tsconfigRootDir: import.meta.dirname,
174173
},
175174
},

static/app/utils/theme/theme.chonk.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {type Theme, useTheme} from '@emotion/react';
33
import styled, {
44
type CreateStyledComponent,
55
type FilteringStyledOptions,
6+
type StyledOptions,
67
} from '@emotion/styled';
7-
import type {StyledOptions} from '@emotion/styled/dist/declarations/src/types';
88
import color from 'color';
99

1010
import type {ColorMapping, FormTheme, Theme as SentryTheme} from './theme';

static/app/views/insights/browser/resources/utils/useResourceFilters.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export type ModuleFilters = {
2525
[BrowserStarfishFields.SPAN_DOMAIN]?: string;
2626
[BrowserStarfishFields.SPAN_OP]?: ResourceSpanOps;
2727
[BrowserStarfishFields.TRANSACTION]?: string;
28-
[BrowserStarfishFields.SPAN_DOMAIN]?: string;
2928
[BrowserStarfishFields.USER_GEO_SUBREGION]?: SubregionCode[];
3029
};
3130

static/app/views/insights/types.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ export type SpanIndexedResponse = {
428428
| 'unavailable'
429429
| 'data_loss'
430430
| 'unauthenticated';
431-
[SpanIndexedField.SPAN_ID]: string;
432431
[SpanIndexedField.SPAN_ACTION]: string;
433432
[SpanIndexedField.TRACE]: string;
434433
[SpanIndexedField.TRANSACTION]: string;
@@ -488,8 +487,6 @@ export type SpanIndexedResponse = {
488487
[SpanIndexedField.LCP_ELEMENT]: string;
489488
[SpanIndexedField.CLS_SOURCE]: string;
490489
[SpanIndexedField.MEASUREMENT_HTTP_RESPONSE_CONTENT_LENGTH]: number;
491-
[SpanIndexedField.PROJECT]: string;
492-
[SpanIndexedField.SPAN_GROUP]: string;
493490
'any(id)': string;
494491
[SpanIndexedField.DB_SYSTEM]: SupportedDatabaseSystem;
495492
[SpanIndexedField.CODE_FILEPATH]: string;

0 commit comments

Comments
 (0)