flow-runtime icon indicating copy to clipboard operation
flow-runtime copied to clipboard

webpack loader

Open mxstbr opened this issue 8 years ago • 4 comments

Issuehunt badges

This is a:

  • [ ] Bug Report
  • [x] Feature Request
  • [ ] Question
  • [ ] Other

It'd be awesome to have a webpack loader so I could automatically get runtime validation of flow types from libraries.

My use case is that I want to validate DraftJS state on the server, which I'd love to do like this:

// Note: .js.flow file
import { RawDraftContentState } from 'flow-runtime-loader!draft-js/lib/RawDraftContentState.js.flow';

const storePost = (body) => {
  t.param('body', RawDraftContentState).assert(body); 
  return storePostInDb({ body });
}

Does something like that exist?


IssueHunt Summary

Backers (Total: $200.00)

Become a backer now!

Or submit a pull request to get the deposits!

Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

mxstbr avatar Oct 28 '17 12:10 mxstbr

Or maybe this already works?

import type { RawDraftContentState } from 'draft-js/lib/RawDraftContentState.js.flow';

const storePost = (body: RawDraftContentState) => {
  return storePostInDb({ body });
}

mxstbr avatar Oct 28 '17 12:10 mxstbr

@mxstbr this doesn't already exist but a webpack loader is definitely something I want, it'd solve a lot of the problems we have that come from babel's single-file-at-a-time approach.

phpnode avatar Nov 13 '17 21:11 phpnode

@issuehunt has funded $200.00 to this issue.


issuehunt-oss[bot] avatar Jul 24 '19 13:07 issuehunt-oss[bot]

Hi, I would like to work in this loader. Is there any platform ( may be twitter ) where we can talk. I got few things to clear up. Thanks.

anikethsaha avatar Sep 30 '19 09:09 anikethsaha