Skip to content

Commit

Permalink
Fixed 08 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed May 10, 2023
1 parent ec810db commit 017dd08
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 54 deletions.
44 changes: 5 additions & 39 deletions scripts/tests/__snapshots__/all.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ src/07-challenges/34-dynamic-reducer.problem.ts(86,23): error TS2344: Type 'fals
src/07-challenges/34-dynamic-reducer.problem.ts(95,7): error TS2578: Unused '@ts-expect-error' directive.
src/07-challenges/34-dynamic-reducer.problem.ts(104,5): error TS2578: Unused '@ts-expect-error' directive.
src/07-challenges/38-challenge-custom-jsx-element.problem.tsx(13,17): error TS2339: Property 'custom-element' does not exist on type 'JSX.IntrinsicElements'.
src/07-challenges/38-challenge-custom-jsx-element.problem.tsx(13,17): error TS17004: Cannot use JSX unless the '--jsx' flag is provided.
src/07-challenges/38-challenge-custom-jsx-element.problem.tsx(13,44): error TS2339: Property 'custom-element' does not exist on type 'JSX.IntrinsicElements'.
src/07-challenges/38-challenge-custom-jsx-element.solution.tsx(18,17): error TS17004: Cannot use JSX unless the '--jsx' flag is provided.
,"
`;
Expand Down Expand Up @@ -482,21 +484,6 @@ exports[`vitest > Should have the correct Vitest errors 1`] = `
"status": "failed",
"title": "Should let you call makeGreeting from the window object",
},
{
"ancestorTitles": [
"",
],
"failureMessages": [
"expected [Function] to be undefined // Object.is equality",
],
"fullName": " Should not be available on globalThis",
"location": {
"column": 5,
"line": 25,
},
"status": "failed",
"title": "Should not be available on globalThis",
},
],
"message": "",
"name": "src/02-globals/08-add-to-window.problem.ts",
Expand All @@ -508,36 +495,15 @@ exports[`vitest > Should have the correct Vitest errors 1`] = `
"ancestorTitles": [
"",
],
"failureMessages": [
"expected 'Hello!' to be 'Hello, world!' // Object.is equality",
],
"failureMessages": [],
"fullName": " Should let you call makeGreetingSolution from the window object",
"location": {
"column": 41,
"line": 21,
},
"status": "failed",
"status": "passed",
"title": "Should let you call makeGreetingSolution from the window object",
},
{
"ancestorTitles": [
"",
],
"failureMessages": [
"expected [Function] to be undefined // Object.is equality",
],
"fullName": " Should not be available on globalThis",
"location": {
"column": 5,
"line": 30,
},
"status": "failed",
"title": "Should not be available on globalThis",
},
],
"message": "",
"name": "src/02-globals/08-add-to-window.solution.ts",
"status": "failed",
"status": "passed",
},
{
"assertionResults": [
Expand Down
7 changes: 0 additions & 7 deletions src/02-globals/08-add-to-window.problem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,3 @@ it("Should let you call makeGreeting from the window object", () => {

type test1 = Expect<Equal<typeof window.makeGreeting, () => string>>;
});

it("Should not be available on globalThis", () => {
expect(
// @ts-expect-error
globalThis.makeGreeting,
).toBe(undefined);
});
9 changes: 1 addition & 8 deletions src/02-globals/08-add-to-window.solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,10 @@ declare global {
}
}

window.makeGreetingSolution = () => "Hello!";
window.makeGreetingSolution = () => "Hello, world!";

it("Should let you call makeGreetingSolution from the window object", () => {
expect(window.makeGreetingSolution()).toBe("Hello, world!");

type test1 = Expect<Equal<typeof window.makeGreetingSolution, () => string>>;
});

it("Should not be available on globalThis", () => {
expect(
// @ts-expect-error
globalThis.makeGreetingSolution,
).toBe(undefined);
});

0 comments on commit 017dd08

Please sign in to comment.