react-native-quizz icon indicating copy to clipboard operation
react-native-quizz copied to clipboard

migrated to rematch new types

Open semoal opened this issue 5 years ago • 6 comments

I've migrated to the new types system, all of them working correctly except the testing suite that is running on a circular reference issue.

Type of property 'settings' circularly references itself in mapped type 'ExtractRematchDispatchersFromModels<RootModel & Models<any>>'.ts(2615)

semoal avatar Aug 19 '20 17:08 semoal

Any suggerence mate? I'm migrating some repos that are not too much complicated to the new types to check if there's any extra issue @tianzhich

semoal avatar Aug 19 '20 17:08 semoal

@haikyuu i hope this is not a problem to you =)

semoal avatar Aug 19 '20 17:08 semoal

1st todo: definitely as is not necessary. I forgot pass TModels to ModelEffect.

2nd todo: why we need TExtraModels? It was unused in the real param initConfig so I removed it. And now there is no circular reference issue.

/**
 * Prepares a complete configuration and creates a Rematch store.
 */
export const init = <
	TModels extends Models<TModels>,
	TExtraModels extends Models
>(
	initConfig?: InitConfig<TModels>
): RematchStore<TModels & TExtraModels> => {
	const config = createConfig(initConfig || {})
	return createRematchStore<TModels, TExtraModels>(config)
}

tianzhich avatar Aug 20 '20 05:08 tianzhich

PR https://github.com/rematch/rematch/pull/805

tianzhich avatar Aug 20 '20 05:08 tianzhich

Well @haikyuu thanks for letting us rape your project a bit haha It's all the types fixed, if you find any issue feel free to notify us!

semoal avatar Aug 26 '20 13:08 semoal

No problem, @semoal It was a pleasure.

haikyuu avatar Aug 27 '20 16:08 haikyuu