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

Typescript: Enable strict mode #728

Merged
merged 3 commits into from
May 13, 2024
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
6 changes: 3 additions & 3 deletions packages/scenes/src/querying/SceneDataTransformer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,9 @@ describe('SceneDataTransformer', () => {

const data = stateUpdates[0].data;
// Verify series are transformed
expect(data.series[0].fields[0].values[0]).toBe(10 * 2);
expect(data?.series[0].fields[0].values[0]).toBe(10 * 2);
// Verify annotations are transformed
expect(data.annotations[0].fields[0].values[0]).toBe(100 + 4);
expect(data?.annotations?.[0].fields[0].values[0]).toBe(100 + 4);
});

describe('With inner query runner', () => {
Expand Down Expand Up @@ -700,7 +700,7 @@ describe('SceneDataTransformer', () => {
dataNode.setState({ data: { ...dataNode.state.data, state: LoadingState.Loading } });

expect(customTransformerSpy).toHaveBeenCalledTimes(1);
expect(transformer.state.data.state).toBe(LoadingState.Loading);
expect(transformer.state.data?.state).toBe(LoadingState.Loading);
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/scenes/src/querying/SceneQueryRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2146,10 +2146,10 @@ describe('SceneQueryRunner', () => {
const clone = queryRunner.clone();

expect(clone['_resultAnnotations']).not.toBeUndefined();
expect(clone['_resultAnnotations'].length).toBe(1);
expect(clone['_resultAnnotations']?.length).toBe(1);
expect(clone['_resultAnnotations']).toStrictEqual(queryRunner['_resultAnnotations']);
expect(clone['_layerAnnotations']).not.toBeUndefined();
expect(clone['_layerAnnotations'].length).toBe(1);
expect(clone['_layerAnnotations']?.length).toBe(1);
expect(clone['_layerAnnotations']).toStrictEqual(queryRunner['_layerAnnotations']);
expect(clone['_results']['_buffer']).not.toEqual([]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ describe('AdHocFiltersVariable', () => {
});

it('Can set a custom value before the list of values returns', async () => {
let resolveCallback;
const delayingPromise = new Promise((resolve) => (resolveCallback = resolve));
let resolveCallback = (v: string) => {};
const delayingPromise = new Promise<string>((resolve) => (resolveCallback = resolve));

const { filtersVar, runRequest } = setup({
getTagValuesProvider: async () => {
Expand All @@ -166,7 +166,7 @@ describe('AdHocFiltersVariable', () => {
await userEvent.type(selects[2], 'myVeryCustomValue');

// resolve the delaying promise
await act(resolveCallback);
act(() => resolveCallback(''));

await userEvent.type(selects[2], '{enter}');

Expand Down Expand Up @@ -535,9 +535,7 @@ describe('AdHocFiltersVariable', () => {
filtersVar._updateFilter(filtersVar.state.filters[0], 'value', { value: '', label: '' });
});

expect(locationService.getLocation().search).toBe(
'?var-filters=key2%7C%3D%7Cval2'
);
expect(locationService.getLocation().search).toBe('?var-filters=key2%7C%3D%7Cval2');
});

it('Can override and replace getTagKeys and getTagValues', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@grafana/tsconfig/base.json",
"extends": "@grafana/tsconfig/tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./compiled",
Expand Down
Loading