After completing all the steps of the tutorial having an error at index.tsx: 19
Property 'name' is missing in type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Props, ComponentState>> & Readonly<{ chi...'. my-app (tsconfig project)
Setting the name property fixes the issue and the sample works as expected:
<Hello name="something" />
Adding a ? after the name property declaration in the Props interface also fixes the issue.
export interface Props {
name?: string;
enthusiasmLevel?: number;
onIncrement?: () => void;
onDecrement?: () => void;
}
thanks
@Excommunicated i don't know if making 'name' property optional is correct fix here.
Is it working at all for anyone without optional name?
Umm. Username possibly.
On Jun 11, 2017 2:41 AM, "Anton Vildyaev" notifications@github.com wrote:
@Excommunicated https://github.com/excommunicated i don't know if
making 'name' property optional is correct fix here.
Is it working at all for anyone without optional name?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript-React-Starter/issues/37#issuecomment-307617378,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWByLCRHz7Co5AD_qMaTm46YXOHLmVovks5sC7ZhgaJpZM4NxtQL
.
@hun1ahpu I completely agree. I was just offering a solution that will work with the compiler as it stands, without having to set the property on the element.s
The underlying issue still remains. The compiler is not recognizing the mapStateToProps function mapping. If anything, it should be reporting if you were to omit setting languageName on the stores initial state.
Seems to be related to https://github.com/Microsoft/TypeScript-React-Starter/issues/29 right? Is the proposed solution there the way to go? And can somebody explain why exactly that works? Best
@DanielRosenwasser could you help? What are we missing? Since it should be possible to omit the 'name' property.
After some research, i think this bug is related to some changes in the typings for react-redux.
Stick the version in package.json to @types/react-redux: "4.4.36" (up to 4.4.40) should "Fix" this issue until a real bugfix is released.
Thank u
same issue as link with #29 #34 #36 #37
I'll try to look into this next Monday. Sorry about the delay!
For me it was a simple typo issue, I forgot to update import statement for Hello component.
Before (source of error)
import Hello from './components/Hello';
After (fixed the issue)
import Hello from './containers/Hello';
@Dev-Dipesh I had the same issue and was stumped for a little while. Thanks for the fix! My feeling is that this is likely what most people are running into, since it is oh so very subtly wrong. I'd try this before any of the other solutions proposed.
Defining the shape of the Props using an interface is like signing an agreement that whenever I will use the component, in this case, Hello, It must have all the required props. Hence using it as
<Hello />
will raise an error cuz you have broken the agreement and typescript comes in to take you to jail unless you have provided the required props
<Hello name="name"/>
So checking in places where you render the component and providing the required props should fix the error
Layla G
On Thu, Oct 18, 2018, 4:22 AM jjagwe dennis notifications@github.com
wrote:
Defining the shape of the Props using an interface is like signing an
agreement that whenever I will use the component, in this case, Hello, It
must have all the required props. Hence using it as
will raise an error cuz you have broken the agreement and typescript comes
in to take you to jail unless you have provided the required props
So checking in places where you render the component and providing the
required props should fix the error—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript-React-Starter/issues/37#issuecomment-430971775,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWByLBpze30Ahy36vKP21soUPQqtbNqAks5umGR4gaJpZM4NxtQL
.
On Thu, Oct 18, 2018, 4:22 AM jjagwe dennis notifications@github.com
wrote:
Defining the shape of the Props using an interface is like signing an
agreement that whenever I will use the component, in this case, Hello, It
must have all the required props. Hence using it as
will raise an error cuz you have broken the agreement and typescript comes
in to take you to jail unless you have provided the required props
So checking in places where you render the component and providing the
required props should fix the error—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript-React-Starter/issues/37#issuecomment-430971775,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWByLBpze30Ahy36vKP21soUPQqtbNqAks5umGR4gaJpZM4NxtQL
.
Most helpful comment
Adding a
?after the name property declaration in thePropsinterface also fixes the issue.