Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: add type checking (#20280)

woppererdfb53513ea6b
diff --git a/packages/web/src/components/codeMirrorWrapper.tsx b/packages/web/src/components/codeMirrorWrapper.tsx
index 1ac346502a..eb551a66da 100644
--- a/packages/web/src/components/codeMirrorWrapper.tsx
+++ b/packages/web/src/components/codeMirrorWrapper.tsx
@@ -27,9 +27,11 @@ export type SourceHighlight = {
type: 'running' | 'paused' | 'error';
};
+export type Language = 'javascript' | 'python' | 'java' | 'csharp';
+
export interface SourceProps {
text: string;
- language: string;
+ language: Language;
readOnly: boolean;
// 1-based
highlight?: SourceHighlight[];
diff --git a/packages/web/src/components/source.tsx b/packages/web/src/components/source.tsx
index cae68a8451..5b0bd7c403 100644
--- a/packages/web/src/components/source.tsx
+++ b/packages/web/src/components/source.tsx
@@ -16,6 +16,7 @@
import * as React from 'react';
import './codeMirrorWrapper.css';
+import type { Language } from './codeMirrorWrapper';
import { CodeMirrorWrapper } from './codeMirrorWrapper';
export type SourceHighlight = {
@@ -25,7 +26,7 @@ export type SourceHighlight = {
export interface SourceProps {
text: string;
- language: string;
+ language: Language;
// 1-based
highlight?: SourceHighlight[];
revealLine?: number;