TypeScript: Support for `strict` type checking

Description

I would be very happy about support for TypeScript’s strict mode, as it greatly helps me to get more value out of TypeScript :slight_smile:

Examples

Currently, when "strict": true is included in tsconfig.json, TypeScript complains that state.source.get has no call signatures in the following example:

import Router from "@frontity/router/types";
import Source from "@frontity/wp-source/types";
import {connect, useConnect} from "frontity";
import {MergePackages} from "frontity/types";
import * as React from "react";

type Packages = MergePackages<Source, Router>;

const Root: React.FC = connect(() => {
	const {state} = useConnect<Packages>();
	const data = state.source.get(state.router.link);
	return <div />;
});

Without strict mode, everything works as expected.

Functionalities

  • Enhance Frontity types to work with strict mode

Requirements, Dependencies, Possible solution

I haven’t worked long enough with Frontity to provide more details here, unfortunately. Also, this is the first issue I am facing with strict mode in Frontity. I can continue to use strict mode and add other related problems here, if you are interested :slight_smile:

Thanks for opening this discussion :slightly_smiling_face:

@dev-team I would love to know your opinion here. Is this something we have experienced in the past or is there any reason to not support it?