Issue 1:
When I try to use children of a component with forwardRef has the next error:

TS2322: Type '{ children: ReactNode; error: boolean; full: boolean; secondary: boolean; type: "submit" | "reset" | "button"; white: boolean; }' is not assignable to type 'IntrinsicAttributes & BaseButtonInnerProps & RefAttributes<HTMLButtonElement>'. Property 'children' does not exist on type 'IntrinsicAttributes & BaseButtonInnerProps & RefAttributes<HTMLButtonElement>'.

The error is in the types:

interface ForwardRefRenderFunction<T, P = {}> {
(props: PropsWithChildren<P>, ref: ((instance: T | null) => void) | MutableRefObject<T | null> | null): ReactElement | null;
displayName?: string;
// explicit rejected with `never` required due to
// https://github.com/microsoft/TypeScript/issues/36826
/**
* defaultProps are not supported on render functions
*/
defaultProps?: never;
/**
* propTypes are not supported on render functions
*/
propTypes?: never;
}

function forwardRef<T, P = {}>(render: ForwardRefRenderFunction<T, P>): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;

That return a type of a component without children, but is you add the children in your props with PropsWithChildren , exists another problem.

The ForwardRefRenderFunction has a duplicate PropsWithChildren

Solution:

Exists 2 ways to solve this:

Wrap PropsWithChildren to PropsWithoutRef<P>

Remove PropsWithChildren of ForwardRefRenderFunction (the user need declare manually the PropsWithChildren in their components)

Autors: @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @DovydasNavickas @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @Hotell @franklixuefei @Jessidhia @saranshkataria @lukyth @eps1lon @zieka @dancerphil @dimitropoulos @disjukr @vhfmag @hellatan

Issue 2:
I tried using the @types/arcgis-js-api package and had problems.

I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript

I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).

Mention the authors (see Definitions by: in index.d.ts) so they can respond.

Authors: @Esri

This is in relation to the arcgis-js-api v3 definitions.

Overview

I have created namespace-style type definitions for v3 of the arcgis-js-api for people who don't use AMD for their whole project. The definitions can be found here: https://github.com/TwitchBronBron/esri-javascript-api-typings. Where in DefinitelyTyped should I put them, and what should I name them since they are just in a different format from the original?

Details

The arcgis-js-api definitions are written assuming that all users will be using the AMD module format. However, we do not write our projects in AMD. Instead, we use standard typescript namespaces, and sprinkle in AMD whenever we need to use the arcgis-js-api pieces. Here's an example:

namespace app {
class MapManager {

private map: any;

createMap(): Promise<any> {
return new Promise((resolve) => {
require(['esri/map'], function (Map) {
this.map = new Map('map-id');
resolve(this.map);
});
});
}
}
}

This prevents us from using the arcgis-js-api TypeScript definitions found in DefinitelyTyped because we are not all-in with AMD.

For everyone who uses the ESRI JavaScript API in this way, it would be valuable to have the types in a standard namespace-style format. We would need to manually assign all of those types to our objects, but there is still a TON of value in having type information about these once they are wired up. Here is how we would consume those definitions:

/// <reference path="path/to/arcgis-js-api-namespaced.d.ts" />
namespace app {
class MapManager {

//Now every consumer of MapManager#map will get type information about the esri map
public map: esri.Map;

createMap(): Promise<esri.Map> {
return new Promise((resolve) => {
require(['esri/map'], function (Map) {
this.map = new Map('map-id');
resolve(this.map);
});
});
}
}
}

I have already created the namespace-style versions of the arcgis-js-api type definitions. You can find them here: https://github.com/TwitchBronBron/esri-javascript-api-typings. I think these belong in DefinitelyTyped, but where in DefinitelyTyped should I put them, and what should I name it since there is already a project with arcgis-js-api in this repository?

Thanks!