Templarian / MaterialDesign-React

Dist for Material Design Icons React Component for JS/TypeScript
https://materialdesignicons.com
MIT License
139 stars 20 forks source link

Added onClick prop to IconProps interface to fix usage with Typescript #38

Closed jhlav closed 4 years ago

jhlav commented 4 years ago

Reference #36

jhlav commented 4 years ago

Also reference #37

jhlav commented 4 years ago

Using Node v12.15.0 and NPM v6.13.4 on Kubuntu 19.10, npm test also threw an error because of the triple backslashes in the command. Presumably this was for another operating system or previous version(s) of some certain tool/library - please correct me on that.

I also ran the build command to generate the compiled and production versions of Icon. That's in this last commit.

jhlav@linux:~/Dev/MaterialDesign-React$ npm test

> @mdi/react@1.2.1 test /home/jhlav/Dev/MaterialDesign-React
> cross-env TS_NODE_SKIP_PROJECT=YES TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\",\"jsx\":\"react\"}' mocha -r ts-node/register -r jsdom-global/register tests/**/*.spec.tsx

undefined:1
{\"module\":\"commonjs\",\"jsx\":\"react\"}
 ^

SyntaxError: Unexpected token \ in JSON at position 1
    at JSON.parse (<anonymous>)
    at parse (/home/jhlav/Dev/MaterialDesign-React/node_modules/ts-node/dist/index.js:85:45)
    at Object.<anonymous> (/home/jhlav/Dev/MaterialDesign-React/node_modules/ts-node/dist/index.js:54:22)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/jhlav/Dev/MaterialDesign-React/node_modules/ts-node/register/index.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /home/jhlav/Dev/MaterialDesign-React/node_modules/mocha/bin/_mocha:511:3
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/jhlav/Dev/MaterialDesign-React/node_modules/mocha/bin/_mocha:510:10)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11
npm ERR! Test failed.  See above for more details.

After removing triple backslash, all 39 tests run successfully.

Templarian commented 4 years ago

Closing this PR after integrating everything except the onClick handler and bumping the deps.

Note, fixed the test command to run cross platform with commonjs.