Coder Social home page Coder Social logo

typescript-generics-workshop's People

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

typescript-generics-workshop's Issues

vitest vs chai type expect / toEqual

When running npm install, it installs @types/chai. Because of this my IDE (webstorm) is using the chai declaration of expect (which does not have toEqual) instead of vitest types. Do we actually need to install those chai types? deleting them seems to fix the issue.

Type error with solution to 04-generics-advanced/19-generic-interfaces-with-functions solution

generic for fetch solution does not work in the official playground

The provided code in the video does not seem to be working.

https://github.com/total-typescript/typescript-generics-workshop/blob/main/src/02-passing-type-arguments/11-data-fetcher.solution.ts

If you take the code and paste it into Typescript playground (I have done it for you) - you will get a bunch of errors.

The solution is as following:

const fetchData = async <T>(url: string): Promise<T> => await fetch(url).then(resp => resp.json as T)

Exo 20.7 working around partial inference problem

Hi,

I just spent 1h trying to solve working around partial inference problem and I decided to watch the solution.
I had the right approach to solve it however Matt didn't experience the same error I had in my local IDE.
The 2nd type argument of makeSelectors have a default value {} in the repo which the code in Matt video doesn't.
Once I removed it from my code all the test pass.

thanks!

14.5-literal-inference.explainer.ts has misleading statements

You have a comment in the 14.5-literal-inference.explainer.ts file:

// When returning the value only, it infers
// the literal type
const returnsValueOnly = <T>(t: T) => {
  return t;
};

const result = returnsValueOnly("a");
//    ^?

This explanation is a bit misleading. In your example, it returns literal type not because of how your function is declared but because of how it is called. In other words, it is returned literal because "a" parameter is interpreted as literal.

For example, if you pre-declare the function's argument as let the type of return value will be a string:

Screenshot 2024-03-23 at 15 51 28

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.