fix(Cache): typescript Map generic type fixed#308
fix(Cache): typescript Map generic type fixed#308dimaslanjaka wants to merge 50 commits intohexojs:masterfrom
Map generic type fixed#308Conversation
make `value` and `returns` as generic type
- disable @typescript-eslint/no-explicit-any to be able treat `value` as any - fixed failed build caused by `Not all constituents of type 'T | function' are callable`
cache now full support like built-in `Map` forked from: https://stackoverflow.com/a/68805082/6404439
detach `dump` from CacheMapper
chore(deps-dev): add `@types/chai` `@types/mocha` refactor(eslintrc): disable unsupported es-syntax for typescript
feat: import `chai.expect` fixed for objects not being sorted by NodeJS built-in `Map`
should be same `3`
fix: CacheMapper using private name
to generify `Cache` sctructure
hotifx Exported variable <variable name> has or is using private name <private name>
| it('get & set', () => { | ||
| cache.set('foo', 123); | ||
| cache.get('foo').should.eql(123); | ||
| should.equal(cache.get('foo'), 123); |
There was a problem hiding this comment.
@types/chat plus import {should} 'chat'; should(); should be enough to correct the type of [any object].prorotype.should, just like this: https://github.com/SukkaW/rollup-plugin-swc/blob/master/test/index.ts
There was a problem hiding this comment.
@types/chatplusimport {should} 'chat'; should();should be enough to correct the type of[any object].prorotype.should, just like this: https://github.com/SukkaW/rollup-plugin-swc/blob/master/test/index.ts
at my device using prototype.should getting error (throw undefined and make all tests failed), instead giving result test failure
There was a problem hiding this comment.
i dont know, why. But using normal chai API can give result failure correctly instead throw all tests runner, that was made me confused, because throw from node_modules paths instead from the tests files
There was a problem hiding this comment.
emm, i think this error caused by running on monorepo/workspace project. cuz all dependents grouped at single node_modules. but, this method easily to sync between packages. maybe, caused by version conflict (auto fixed by yarn), i dont know. Remembering all hexo packages has different dev dependencies versions.
There was a problem hiding this comment.
error says:
cannot read property 'should' of undefined
There was a problem hiding this comment.
sometimes got error like:
cannot read property 'eql' ... so on
There was a problem hiding this comment.
so to prevent useless error, prefer using original chai expect, should API for safety :)
from package `hexo-util`
refactor: split cache typescript test
…into fix-cache
chore(CacheMapper): drop `size` manipulator chore(Cache): get `CacheMapper` size by keys count
prevent exposed to index exports (VSCode, Intellij IDEA)
create new variable `newValue` to manipulate value parameter
fixed by count the `Map.keys` length
…into fix-cache
feat: add overload `get` method


feat: add CacheMapper
implement built-in javascript
Mapwith full function usages.CacheMapperimplementingMap<KEY, VALUE>which is genericableMap<string, V>to prevent variable class imported usingprivatename, whichVis Generic typeCache<V>implementingCacheMapper<string, V>fix: generic type
CacheclassExported variable 'cache' has or is using private name 'cache'because type
anyis not allowed by ESLint so I created a mapper class with full typeStrong which can be generalizedfixed generic type screenshot

chore(deps-dev): add
@types/chaiand@types/mochato support mocha, chai for used in typescript, we need
@types/chaiand@types/mochafeat: add strict type test for
Cachedefine cache class with various type (still on-going creating an tests)