immutable-js-oss / immutable-js

Immutable persistent data collections for Javascript which increase efficiency and simplicity.
https://immutable-js-oss.github.io/immutable-js/
MIT License
37 stars 6 forks source link

Receiving transpilation error when using Map.get in Typescript environment #162

Closed Methuselah96 closed 4 years ago

Methuselah96 commented 4 years ago

From @dcs3spp on Wed, 06 Nov 2019 14:40:28 GMT

I am trying to learn redux and immutable.js in a Typescript environment. I am receiving a transpilation error in my selector when using the get method of my Map.

// ./selectors.ts

import { ErrorState } from './reducer';
import { ErrorReport } from './types';

// type ErrorState = { error: Map<string, Set<ErrorReport>> }
// type ErrorReport = {
//  info: Error;
//  raisingAction: string;
//  sourceComponent: string;
//};

export const getReduxErrors = (
  state: ErrorState,
  search: string,
): Set<ErrorReport> | undefined => state.error.get(search);

The transpilation error that I receive is:

 Property '[Symbol.toStringTag]' is missing in type 'import("/mnt/9182c1a5-20ad-4aaf-b785-996d978bf303/DevProjects/nodejs/react_application/node_modules/immutable/dist/immutable-nonambient").Set<import("/mnt/9182c1a5-20ad-4aaf-b785-996d978bf303/DevProjects/nodejs/react_application/src/app/redux/features/error/types").ErrorReport>' but required in type 'Set<import("/mnt/9182c1a5-20ad-4aaf-b785-996d978bf303/DevProjects/nodejs/react_application/src/app/redux/features/error/types").ErrorReport>

Has anyone else experienced this before?

Copied from original issue: https://github.com/immutable-js/immutable-js/issues/1748

Methuselah96 commented 4 years ago

Answered in original repo.