saveAsJSON() method not found
See original GitHub issueThe README says that you can call .saveAsJSON()
on any bloom filter to get a serialization of the bloom filter state that can be persisted or sent over the network. When I try to use it, however, my Typescript code fails to compile with the error: error TS2339: Property 'saveAsJSON' does not exist on type 'BloomFilter'
.
My code looks like:
import { BloomFilter } from 'bloom-filters'
// [...]
const bloomFilterEntries = new Set<string>()
// [...]
const bloomFilter = BloomFilter.from(bloomFilterEntries, 0.01)
const bloomJSON = bloomFilter.saveAsJSON()
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (1 by maintainers)
Top Results From Across the Web
FabricJS object.set() gives not a function error when loading ...
After performing actions with fabric js, I convert the content of the canvas to json and save it to localstorage by calling saveAsJson()...
Read more >Saving workbook using SaveSettings causes JSON ...
I am trying to save a workbook using my ASP.NET Core 6 backend API. The workbook is sent to a controller method on...
Read more >How to print the json (pretty) response and also save as json
MissingMethodException: No signature of method: static groovy.json. ... prettyPrint() is applicable for argument types: ... not working.
Read more >Class WorkBook | C# Excel API | IronXL - IronSoftware
Methods. Close(). Closes the workbook object. Once this has been called, no further operations, ... Returns null if the named worksheet would not...
Read more >JSON Files - Spark 3.3.1 Documentation
Property Name Default Scope
primitivesAsString false read
prefersDecimal false read
allowComments false read
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Callidon @stbrody Unfortunately with our templating methods and decorators we cannot make a small change without redefining fromJSON in all Filters of the project. So in the last commit I defined the return type of
fromJSON
toany
this way you can have type definitions only in two ways.const b: BloomFilter = BloomFilter.fromJSON(bloomJSON)
const b = BloomFilter.fromJSON(bloomJSON) as BloomFilter
This is the only solution for us.
Working example:
PS: Just a reminder if you are not aware of it, don’t even try to test or add data on a Filter that are initialized with an empty set or array. It will cause
RangeError: Maximum call stack size exceeded
. T.from functions are used to initialize filters with predefined values. Otherwise use the classic constructor or theT.create
function to initialize a filter of fixed size with desired error rate.The method exists for all classes in the package, but I think the latest rework might have removed the method from the definition files, which causes your TypeScript compiler to fail.
I can’t promise that we can provide a fix quickly, because we now have very little time to work on open source projects (sadly). But I will definitively look into it, because that 's a rather nasty bug !