Code Monkey home page Code Monkey logo

Comments (10)

toranb avatar toranb commented on August 15, 2024

For anyone who might follow - until this is supported legit I've got a simple type defs repo up that seems to make the compiler happy for now

https://github.com/toranb/ember-fetch-tsdefs/blob/master/index.d.ts

npm install ember-fetch-tsdefs -D

from ember-fetch.

stefanpenner avatar stefanpenner commented on August 15, 2024

Is there a downside to submitting those types to this repo?

from ember-fetch.

toranb avatar toranb commented on August 15, 2024

@stefanpenner good question .. mostly that Toran is the furthest thing from "expert types ninja" at the moment. If someone else can jump in and confirm "yup -looks legit bro" then I say we could ship it and iterate

Here is how I'm using that btw

  return fetch('/api/restaurants')
    .then((fetched: Response) => fetched.json())
    .then((response: Restaurants) => dispatch({
      type: ActionTypes.TRANSFORM_LIST,
      response: response
    }));

from ember-fetch.

stefanpenner avatar stefanpenner commented on August 15, 2024

@toranb if you have cycles to submit it as a PR, I can gladly take a look :). I'll also bug señor @krisselden (our resident guru of everything) to review.

from ember-fetch.

toranb avatar toranb commented on August 15, 2024

@stefanpenner it's possible - 2 questions related to submitting a PR for this

  1. how does one test this? it could require we add typescript to this repo as a devDependency
  2. what min version of typescript will we support? I'm using TS v2.3 right now for example

from ember-fetch.

toranb avatar toranb commented on August 15, 2024

example of typescript-definition-tester in action

https://github.com/gaearon/redux-thunk/pull/77/files

note: this could be considered "over kill" - worth mentioning either way

from ember-fetch.

stefanpenner avatar stefanpenner commented on August 15, 2024

I'll ask @krisselden to chime in.

from ember-fetch.

stefanpenner avatar stefanpenner commented on August 15, 2024

@toranb i suspect just running the ts validate step is sufficient for testing.

from ember-fetch.

toranb avatar toranb commented on August 15, 2024

@stefanpenner good call boss - I'll wait to hear from @krisselden on what he thinks of these type defs :)

from ember-fetch.

toranb avatar toranb commented on August 15, 2024

@stefanpenner closing this out for now - we can continue discussion in the PR

from ember-fetch.

Related Issues (20)

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.