-
Notifications
You must be signed in to change notification settings - Fork 1
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
Final conversion of repo from JS to TS #20
Conversation
Misc. cleanup of other types
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
[skip ci]
Don't allow non-string for contains, startsWith, or endsWith
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.
Looks awesome.
@@ -65,7 +65,7 @@ const compileModel = <TSchema extends GenericObject = GenericObject>( | |||
public readonly __v: string | null; | |||
|
|||
/** Private id tracking property */ | |||
private __id: string | null; | |||
#__id: string | null; |
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.
Is this the only place where we were prefixing private members with an underscore? With the private keyword it doesn't seem necessary anymore.
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.
I agree about not needing the underscore prefix any longer, but we probably have to be a little careful with Model
/Document
instances since the properties of the schema get merged into it. I suppose no identifier is truly safe from being used by a consumer (short of throwing an error in the Schema
constructor if they get used), but hopefully something prefixed with two underscores will avoid a potential clash.
I believe I removed the underscore from everywhere otherwise, with the exception of _id
, __v
, and _raw
which are named as such by convention.
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.
The nice thing about the use of the private identifier is that this.#_id
and this._id
can coexist so it can't be accidentally clobbered.
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.
Hmm, I think I knew that, but didn't really think about it. I will convert it over in my other open PR.
This PR completes the conversion of the repo from JavaScript to TypeScript. Included in this PR:
src/ts
folder to the rootsrc
folder#shared
alias from tsconfig, babel config, and eslint config. This is because declaration file generation does not work with the aliased paths, and the benefit of that outweighs the benefit of the aliasing.src/shared
folder in favor ofsrc/group
folders.package.json
Model
and its parentDocument
. TS will not build the declaration file for members declared as private which are part of a class returned from a function.Query
constructor to acceptnull
Although there are a lot of files in this PR, most of it is renames along with changes to use relative pathing.