Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during webpack build #1

Closed
theladyjaye opened this issue Feb 6, 2017 · 6 comments
Closed

Error during webpack build #1

theladyjaye opened this issue Feb 6, 2017 · 6 comments
Assignees
Labels

Comments

@theladyjaye
Copy link
Contributor

#1 thanks for this lib! I can't wait to try this out (react-habitat + react-habitat-redux) but I am getting a build error and wondering if I am just missing something obvious:

[at-loader] Checking finished with 1 errors
[at-loader] node_modules/react-habitat-redux/index.d.ts:19:15
    TS2420: Class 'Container' incorrectly implements interface 'IReduxContainer'.
  Types of property 'constructor' are incompatible.
    Type 'Function' is not assignable to type '(store: any) => IReduxContainer'.
      Type 'Function' provides no match for the signature '(store: any): IReduxContainer'

Dependencies

    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-habitat": "^0.4.1",
    "react-habitat-redux": "^1.0.1",
    "react-redux": "^5.0.2",
    "redux": "^3.6.0"
@theladyjaye
Copy link
Contributor Author

theladyjaye commented Feb 6, 2017

It looks like Container just needs it's interface updated:

export interface IContainer {

	/**
	 * Register a new component in the container
	 * @param {string}      name        - The key that identifies this component
	 * @param {*}           comp        - The component class
	 */
	register: (name: string, comp: any) => void;

	/**
	 * Register multiple components in the container
	 * @param {object}      comps        - The components
	 */
	registerAll: (comps: {}) => void;

	/**
	 * Get a registered component for a key
	 * @param {string}      name        - The key name of the component that has been registered
	 */
	resolve: (name: string) => any;

	/**
	* The container's unique id
	*/
	id: () => string;

	/**
	 * The containers dom factory
	 */
	domFactory: () => IDomFactory;
}

react-habitat just got ahead of react-habitat-redux it seems?

@theladyjaye
Copy link
Contributor Author

theladyjaye commented Feb 6, 2017

This might be what we need:

export interface IReduxContainer extends IContainer {
	/**
	 * Register a new component in the container
	 * @param {string}      name        - The key that identifies this component
	 * @param {*}           comp        - The component class
	 */
	register: (name: string, comp: any) => void;

	/**
	 * Register multiple components in the container
	 * @param {object}      comps        - The components
	 */
	registerAll: (comps: {}) => void;

	/**
	 * Get a registered component for a key
	 * @param {string}      name        - The key name of the component that has been registered
	 */
	resolve: (name: string) => any;

	/**
	* The container's unique id
	*/
	id: () => string;

	/**
	 * The containers dom factory
	 */
	domFactory: () => IDomFactory;
}

export interface ReduxStoreConstructable{
	new (store: any): IReduxContainer;
}

declare module ReduxHabitat {
	export var Container: ReduxStoreConstructable;
}

Note that:

// /**
//  * Register a component
//  */
// registerComponent: (name: string, comp: any) => void;

Is not present in IContainer

@jennasalau
Copy link
Contributor

Ahh yes the interface is outdated.

Thanks for raising the issue and investigating!

I can update it this coming weekend. If you need it sooner, please put in a PR and I can release it for you.

Thanks
Jenna

@jennasalau jennasalau added the bug label Feb 6, 2017
@jennasalau jennasalau self-assigned this Feb 6, 2017
@theladyjaye
Copy link
Contributor Author

I'll PR it for you. I just wanted to be sure that registerComponent was indeed supposed to be omitted. Seems to be the case.

@theladyjaye
Copy link
Contributor Author

theladyjaye commented Feb 6, 2017

See: #2

Let me know if you want me to make any adjustments, I'll be happy to.

@jennasalau
Copy link
Contributor

Thanks so much @aventurella

Yeah registerComponent is an old deprecated method for the simpler register.

This issue is now resolved in v1.0.2 in conjunction with react habitat v0.4.2

Thanks for your contribution, greatly appreciated.

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

No branches or pull requests

2 participants