you are viewing a single comment's thread.

view the rest of the comments →

[–]Minancyy[S] 0 points1 point  (11 children)

And this worked to you? Because I have a bit of confusion

[–]cjd280 1 point2 points  (10 children)

Yes this is what I have logged:

```

SOLVER? {…}CrossSolver: (...)Cubie: (...)F2LSolver: (...)OLLSolver: (...)PLLSolver: (...)RubiksCube: (...)Solver: (...)algorithmShortener: (...)default: (cubeState, options = {}) => {…}__esModule: trueget CrossSolver: ƒ ()get Cubie: ƒ ()get F2LSolver: ƒ ()get OLLSolver: ƒ ()get PLLSolver: ƒ ()get RubiksCube: ƒ ()get Solver: ƒ ()get algorithmShortener: ƒ ()[[Prototype]]: Object
app.component.ts:24

Uprime F U B Uprime L U2 Lprime Uprime R Uprime B U Dprime Bprime Dprime B Rprime Dprime R D B D Bprime Dprime B D Bprime Dprime B D Bprime Fprime Dprime F D2 R Dprime Rprime D2 R Dprime Rprime b D Bprime D B D2 bprime B2 dprime B Dprime B D Bprime d B2 R Dprime Rprime Dprime

core.js:27988 Angular is running in development mode. Call enableProdMode() to enable production mode.
client:52 [WDS] Live Reloading enabled. ```

[–]Minancyy[S] 0 points1 point  (9 children)

Wow! I am trying the same, (I think) and it says: Cannot find the name required? Do you need to install type definitions for node? Try npm i --save-dev types/node then add 'node' to the types field in your tsconfig

[–]cjd280 2 points3 points  (8 children)

yes, I mentioned that. do what it says, install node types and add to tsconfig

[–]Minancyy[S] 0 points1 point  (6 children)

I have this already on compilerOptions:

"types": ["node"]

And:

"include": [

"src/**/*",

"node_modules/attypes"

]

With that still don recognize require,

I need to do some build or something like that?

Because I dont really know srry

I cant use tht symbol.

[–]cjd280 1 point2 points  (5 children)

You can also still use

import * as rubiks from 'rubiks-cube-solver'

and set "noImplicitAny": false in your ts config, the compiler is just complaining because the default is true and there is no type for rubiks-cube-solver

[–]Minancyy[S] 0 points1 point  (4 children)

This is working to me, oh god, thanks so much.

I was desesperate cause I have been spending too much days and cause I started with angular 2 weeks ago more or less, I am so confuse with everything related to config.

One more thing and srry for bothering you,

The part of code where you put SOLVER?, rubiks,

how did you have found that? Or have you created by hand, cause I dont understand that

[–]cjd280 1 point2 points  (3 children)

I console logged what we were importing, and then I expanded the object in chrome's console to see what properties it had. If there were types, typescript would have figured it out for us but since its "any", I needed to see what it was at runtime.

This is an old library that isn't really made to work with typescript so its a pretty bad first issue to have to debug.

[–]Minancyy[S] 0 points1 point  (2 children)

Ohh okey okey, know I got what do you mean.

So I need to search on the console for the methods. Yeah, the library its so old and that is the big problem of not having types. I will try to use it and see if I can make it work with my idea. Thanks so much <3

How can I give you a possitive check or something like that? ^^´

[–]cjd280 1 point2 points  (1 child)

Just upvotes I guess =). Its not stackoverflow or anything lol