-
Notifications
You must be signed in to change notification settings - Fork 6
remove hard dependency on protobufjs #19
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
|
|
||
| import { sumOfRange } from './util'; | ||
| import type { Store } from './types'; | ||
| import { Store as ProtoStore, IStore } from '../proto/compiled'; | ||
| import { IStore } from '../proto/compiled'; | ||
|
|
||
| /** The default number of bins to grow when necessary */ | ||
| const CHUNK_SIZE = 128; | ||
|
|
@@ -232,6 +232,7 @@ export class DenseStore implements Store<DenseStore> { | |
| } | ||
|
|
||
| toProto(): IStore { | ||
| const ProtoStore = require('../proto/compiled').Store; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just out of curiosity, did you try to get these to work with dynamic import? Benefit would be not needing the lint override.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would change the API since it makes the call asynchronous and uses a promise. |
||
| return ProtoStore.create({ | ||
| contiguousBinCounts: this.bins, | ||
| contiguousBinIndexOffset: this.offset | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some static
imports to/proto/compiledat the top of this file, does that matter? I would sort of expect that any one of those would cause the module missing error, regardless of if an end user is invokingtoProto/fromProto.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the TypeScript compiler is able to understand that actual code isn't used and not add the
requirecall.