Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Hotloading TSX files with interfaces does not seem to be working #254

Closed
odinnix opened this issue Aug 11, 2016 · 2 comments
Closed

Hotloading TSX files with interfaces does not seem to be working #254

odinnix opened this issue Aug 11, 2016 · 2 comments

Comments

@odinnix
Copy link

odinnix commented Aug 11, 2016

This might be my setup, but hotloading React modules crashes if you reference an interface:

IFormInput.ts

export interface IFormInput
{
   Value?: string;
   OnModelChange?: Function;
   PropertyName?: string;
   ValidationError?: string;
}

React Module

import {IFormInput} from "./IFormInput";

@observer
export default class FormInputGroup extends React.Component<IFormInput, any>
{
 ...trimmed react code
}

Webpack builds everything fine and the application works, however when I make a change and the hotloader fires I get several errors around the interface:

image

@odinnix
Copy link
Author

odinnix commented Aug 11, 2016

I redid how I import things and now it seems to work fine:

Exporting all components/interfaces in a single file:

export * from "./Form";
export * from "./FormTextBox";
//export * from "./FormDropDown";
export * from "./FormInputGroup";
export * from "./FormLabel";
export * from "./FormSubmitButton";
export * from "./IFormInput";
export * from "./IFormModel";

And then importing via:

import * as FormComponents from '../../Forms/FormImports';

Seems to fix hotloading.

@SteveSandersonMS
Copy link
Member

Glad you got it fixed. I'm not aware of any specific technical issues with using TypeScript that way, but will keep a lookout in case anyone else reports troubles.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants