Closed jmcaffee closed 5 years ago
Please provide a codepen/codesandbox/jsfiddle with the error so I can see what's going on.
Your copy-pasted code seems to contain some errors:
import ( FieldFeedbacks, FieldFeedback }
: (
should be {
<Form horizontal>
: <FormWithConstraints ...>
is missingReact.Component<FormDetailProps, {}>
can be simply written React.Component<FormDetailProps>
thx to recent @types/react
changes)Did you try one of the TypeScript example from https://github.com/tkrotoff/react-form-with-constraints/tree/master/examples ?
I've released 0.6.4 with some minor TypeScript adjustments due to very recent @types/react
updates.
These adjustments should be unrelated to your TypeScript error. With this release I've re-checked everything and all react-form-with-constraints tests and TypeScript examples are compiling fine.
Thanks for taking the time to look at this.
Ignoring the syntax errors (due to me mistyping my example), the solution to the compile errors was to upgrade my TypeScript
version to 2.4.2
and @types/react
to 15.6.6
This issue it's replicable on the current master
After a bit of investigatio, the root cause is import React from 'react';
in your code. This, for other projects which don't set allowSyntheticDefaultImports
to true
, doesn't work. Maybe you can change it to import * as React from 'react';
or put this requirement of enabling allowSyntheticDefaultImports
in the documentation?
@cozmy
for other projects which don't set
allowSyntheticDefaultImports
totrue
, doesn't work
Thx for the report, I will investigate if there is a way to support allowSyntheticDefaultImports
both true
and false
I guess the good old find-and-replace would do the trick here. Just replace import React from 'react'
with import * as React from 'react'
. It should not break any functionality.
@cozmy I went back to import * as React
with this commit: b18d61514a5b3d91413210d4915fabdff1e2459f
Thanks
I'm receiving errors when trying to import and use the package's
FieldFeedbacks
andFieldFeedback
components.We're currently running:
I've tried using the following versions of react-form-with-constraints with the same results (thinking it might be because of your react 16 updates in the recent versions):
I'm getting ready to try
0.5.2
before giving up and moving on but I like the simplicity of this lib and I really hope I can get it to work.Example code:
Is the problem because I'm not running react 16? Or something else I'm missing?
Thanks for your time