Code Monkey home page Code Monkey logo

advanced-patterns-workshop's People

Contributors

freiondrej-lokalise avatar louwers avatar mattpocock avatar renovate[bot] avatar tayiorbeii avatar vojtaholik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

advanced-patterns-workshop's Issues

exercise 10 event dispatcher type check errors

Both in the stackblitz in the course and on my local machine with the run exercise command, the tests pass but then type checking has the following error

Checking types...
src/02-globals/10-event-dispatcher.problem.1.ts:34:19 - error TS2322: Type '"LOG_OUT"' is not assignable to type '"LOG_IN"'.

34   dispatchEvent({ type: 'LOG_OUT' });
                     ~~~~

  src/02-globals/10-event-dispatcher.problem.1.ts:22:7
    22       type: K;
             ~~~~
    The expected type comes from property 'type' which is declared here on type '{ type: "LOG_IN"; } 
& { username: string; password: string; }'

I copied the LOG_OUT event over to problem file 1 and this fixed the problem.

But then I renamed problem file 2 to 10.1 and ran npm run exercise 10.1 and it can't find UnionOfDispatchableEvents

So I'm guessing this is because a single file is being type checked in isolation so in file 1 there is no 'LOG_OUT' and in file 2 there is no UnionOfDispatchableEvents. Is that right?

Exercise 08 - Test failing with solution

Steps to reproduce:

  1. Copy 08-add-to-window.solution.ts to 08-add-to-window.problem.ts
  2. Run npm run exercise 08

Test will fail with following error:

Screenshot 2023-03-22 at 15 55 17

In addition, the greeting returned doesn't match the test expectation.

window.makeGreetingSolution = () => 'Hello!'

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

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/renovate-checks.yml
npm
package.json
  • @total-typescript/exercise-cli ^0.10.0
  • typescript 5.5.4
  • vitest ^1.6.0

  • Check this box to trigger a request for Renovate to run again on this repository

Explain how to create new file in Stackblitz Editor

Hello,

for https://github.com/total-typescript/advanced-patterns-workshop/blob/main/src/05-external-libraries/26.5-override-external-lib-types.solution.ts and https://github.com/total-typescript/advanced-patterns-workshop/blob/main/src/05-external-libraries/26.5-declaration.solution.d.ts, it would be helpful to add a hint how to display project files (and thus allow creating a new file) in the StackBlitz Editor - I only found out by accident that you can go with CMD+B to display it, didn't find a GUI way to do that which prevented me to proceed with the solution. ๐Ÿ™‚

Part of problem tests missing for the 'Add Functionality to Existing Global Interfaces' problem

This last part is missing from the problem's tests at the bottom. (It's visible in the solutions video and in the problem's description on the side.

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

Edit:
After adding this part and trying it out, I see it's not totally appropriate - perhaps typescript has changed its behavior in the past few updates.

Logic issue in 22th problem example

I found the logical issue in 22th problem

Middleware type don't consider promises as output.

If we add one more middleware after middleware with async function we see that req become Promise:

image

Solution: add Promise<> variant to return value:

use<NewTOutput extends TOutput>(
    middleware: Middleware<TOutput, NewTOutput | Promise<NewTOutput>>
  ): DynamicMiddleware<TInput, NewTOutput>  {
    this.middleware.push(middleware);
    ...

+ | Promise<NewTOutput> solves the problem

tsc error due to passing paths in the commandline on all the exercises

error TS6064: Option 'paths' can only be specified in 'tsconfig.json' file or set to 'null' on command line. is returned in "Checking types..."

This is due to paths being specified in tsconfig.json and the cli parsing the tsconfig.json file and converting it into commandline arguments. However, paths can't be converted hence the error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.