Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

removing aot tests + fixing playground (#1183)

bautistaaac0b641966288
diff --git a/apps/web/src/app/[locale]/(playgrounds)/challenge-playground/wrapper.tsx b/apps/web/src/app/[locale]/(playgrounds)/challenge-playground/wrapper.tsx
index c77e82cd..090e5138 100644
--- a/apps/web/src/app/[locale]/(playgrounds)/challenge-playground/wrapper.tsx
+++ b/apps/web/src/app/[locale]/(playgrounds)/challenge-playground/wrapper.tsx
@@ -14,6 +14,7 @@ export function Wrapper() {
const updatePlaygroundCodeLocalStorage = (code: string) => {
updateValues({ ...values, challenge: { ...values.challenge, code } });
};
+
return (
<CodePanel
challenge={values.challenge}
diff --git a/challenges/aot/2023/blank/metadata.json b/challenges/aot/2023/blank/metadata.json
deleted file mode 100644
index cf5eb6ea..00000000
--- a/challenges/aot/2023/blank/metadata.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "id": "lower-snake-case",
- "label": "Lower Snake Case",
- "description": "Try to keep it to one shortish sentence.",
- "difficulty": "beginner",
- "prerequisites": [],
- "author": "your-github-user-id"
-}
diff --git a/challenges/aot/2023/blank/prompt.md b/challenges/aot/2023/blank/prompt.md
deleted file mode 100644
index f636ea4b..00000000
--- a/challenges/aot/2023/blank/prompt.md
+++ /dev/null
@@ -1,11 +0,0 @@
-## What Problem XYZ Solves
-
-Explain: why this is important or useful knowledge
-
-## How To Use XYZ
-
-What's the API of the type? What generics and in what order?
-
-## Solving This Challenge
-
-Short and to-the-point. Should be _possible_ to skip everything above and just read this.
diff --git a/challenges/aot/2023/blank/solutions/1.ts b/challenges/aot/2023/blank/solutions/1.ts
deleted file mode 100644
index e69de29b..00000000
diff --git a/challenges/aot/2023/blank/tests.ts b/challenges/aot/2023/blank/tests.ts
deleted file mode 100644
index 78123de9..00000000
--- a/challenges/aot/2023/blank/tests.ts
+++ /dev/null
@@ -1 +0,0 @@
-import { Expect, Equal } from 'type-testing';
diff --git a/challenges/aot/2023/blank/tsconfig.json b/challenges/aot/2023/blank/tsconfig.json
deleted file mode 100644
index d8de5a26..00000000
--- a/challenges/aot/2023/blank/tsconfig.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "compilerOptions": {
- "strict": true,
- "exactOptionalPropertyTypes": true,
- "noUncheckedIndexedAccess": true
- }
-}
diff --git a/challenges/aot/2023/blank/user.ts b/challenges/aot/2023/blank/user.ts
deleted file mode 100644
index 5c69415c..00000000
--- a/challenges/aot/2023/blank/user.ts
+++ /dev/null
@@ -1 +0,0 @@
-type XYZ = unknown;
diff --git a/challenges/default-generic-arguments/tests.ts b/challenges/default-generic-arguments/tests.ts
index 77e70737..a63deedd 100644
--- a/challenges/default-generic-arguments/tests.ts
+++ b/challenges/default-generic-arguments/tests.ts
@@ -1,31 +1,17 @@
import { Expect, Equal } from 'type-testing';
-type test_ApiRequest_explicitPost = Expect<Equal<
- ApiRequest<string, 'POST'>,
- { data: string; method: 'POST' }
->>;
+type test_ApiRequest_explicitPost = Expect<
+ Equal<ApiRequest<string, 'POST'>, { data: string; method: 'POST' }>
+>;
-type test_ApiRequest_implicitGet = Expect<Equal<
- ApiRequest<number>,
- { data: number; method: 'GET' }
->>;
+type test_ApiRequest_implicitGet = Expect<
+ Equal<ApiRequest<number>, { data: number; method: 'GET' }>
+>;
-type test_TSConfig_default = Expect<Equal<
- TSConfig,
- { strict: true }
->>;
+type test_TSConfig_default = Expect<Equal<TSConfig, { strict: true }>>;
-type test_TSConfig_true = Expect<Equal<
- TSConfig<{ strict: true }>,
- { strict: true }
->>;
+type test_TSConfig_true = Expect<Equal<TSConfig<{ strict: true }>, { strict: true }>>;
-type test_TSConfig_false = Expect<Equal<
- TSConfig<{ strict: false }>,
- { strict: false }
->>;
+type test_TSConfig_false = Expect<Equal<TSConfig<{ strict: false }>, { strict: false }>>;
-type test_TSConfig_boolean = Expect<Equal<
- TSConfig<{ strict: boolean }>,
- { strict: boolean }
->>;
+type test_TSConfig_boolean = Expect<Equal<TSConfig<{ strict: boolean }>, { strict: boolean }>>;
diff --git a/packages/monaco/src/index.tsx b/packages/monaco/src/index.tsx
index 4e8ec03e..bfbb1de3 100644
--- a/packages/monaco/src/index.tsx
+++ b/packages/monaco/src/index.tsx
@@ -42,7 +42,7 @@ export function CodePanel(props: CodePanelProps) {
const [tsErrors, setTsErrors] = useState<TsErrors>();
const [isTestPanelExpanded, setIsTestPanelExpanded] = useState(true);
const [localStorageCode, setLocalStorageCode] = useLocalStorage(
- `challenge-${props.challenge.slug}`,
+ props.challenge.slug !== 'test-slug' ? `challenge-${props.challenge.slug}` : '',
'',
);
@@ -60,6 +60,7 @@ export function CodePanel(props: CodePanelProps) {
};
const [code, setCode] = useState(() => getDefaultCode());
+ const [tests, setTests] = useState(() => props.challenge.tests);
useResetEditor().subscribe('resetCode', () => {
setCode(props.challenge.code);
setLocalStorageCode(props.challenge.code);
@@ -110,7 +111,7 @@ export function CodePanel(props: CodePanelProps) {
monaco={monacoInstance}
expandTestPanel={isTestPanelExpanded}
setIsTestPanelExpanded={setIsTestPanelExpanded}
- tests={props.challenge.tests}
+ tests={tests}
userCode={code}
onMount={{
tests: async (editor, monaco) => {
@@ -178,7 +179,7 @@ export function CodePanel(props: CodePanelProps) {
props.updatePlaygroundTestsLocalStorage?.(code ?? '');
if (!monacoInstance) return null;
- setCode(code);
+ setTests(code);
setLocalStorageCode(code);
const getTsWorker = await monacoInstance.languages.typescript.getTypeScriptWorker();