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

Map not supported #225

Closed
wassy92x opened this issue Feb 7, 2020 · 3 comments
Closed

Map not supported #225

wassy92x opened this issue Feb 7, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@wassy92x
Copy link
Contributor

wassy92x commented Feb 7, 2020

Hello,

I found another problem with the Map-Class.
If I write the following code:

interface Foo {
    c: Map<string, string>;
}
const foo: Foo = createMock<Foo>();

The resulting object doesn't have the key "c":

import * as ɵRepository from "ts-auto-mock/repository";
import * as ɵExtension from "ts-auto-mock/extension";
import * as ɵMerge from "ts-auto-mock/merge";
ɵRepository.ɵRepository.instance.registerFactory("@Foo_1", function(t) {
    return (function() {
        var d = {},
            m = {};
        Object.defineProperty(m, ɵExtension.ɵMarker.instance.get(), {
            value: !0
        });
        return m;
    })();
});
import {
    createMock
} from 'ts-auto-mock';
const foo = ɵRepository.ɵRepository.instance.getFactory("@Foo_1")([]);

Is this issue known?
My environment:

  • ts-auto-mock: 1.5.2
  • ttypescript: 1.5.10
  • typescript: 3.7.5

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noImplicitAny": false,
    "noImplicitThis": true,
    "skipLibCheck": true,
    "lib": [
      "dom",
      "ES6"
    ],
    "module": "ES6",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "ES6",
    "plugins": [
      { "transform": "ts-auto-mock/transformer" }
    ]
  },
  "include": [
    "src/**/*.ts",
    "typings/index"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false
}
@Pmyl
Copy link
Collaborator

Pmyl commented Feb 8, 2020

This issue is new and very weird, I’m going to investigate

@Pmyl Pmyl added the bug Something isn't working label Feb 8, 2020
@Pmyl Pmyl self-assigned this Feb 8, 2020
Pmyl added a commit that referenced this issue Feb 8, 2020
Also changed a linting rule for indentation, remove some code regarding typescript types, fixed a bug when using typeof variable without type and function call initializer and removed descriptor 'case' for function call
uittorio pushed a commit that referenced this issue Feb 8, 2020
* #225 add Map support as a type

Also changed a linting rule for indentation, remove some code regarding typescript types, fixed a bug when using typeof variable without type and function call initializer and removed descriptor 'case' for function call

* remove extra webpack configuration

* use custom function to get null descriptor

* remove casting, use typescript function to narrow type

* handle callExpression in descriptor, handle calls of variables
@uittorio
Copy link
Member

uittorio commented Feb 8, 2020

Hi, @wassy92x thank you again for supporting the library.

this issue has been fixed. new version 1.5.4.

Thanks @Pmyl for fixing the issue

@uittorio
Copy link
Member

This bug has been fixed. Feel free to re open another one if its still happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants