Skip to content
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

react-json-tree NodeType definition #659

Open
paztis opened this issue Oct 28, 2020 · 2 comments
Open

react-json-tree NodeType definition #659

paztis opened this issue Oct 28, 2020 · 2 comments

Comments

@paztis
Copy link

paztis commented Oct 28, 2020

Currently NodeType is only defined as a String
It can be great to have a constants / enum definition to avoid to hardcode their usage in our project, like this:

export enum NodeType {
    Object ='Object',
    Error ='Error',
    WeakMap = 'WeakMap',
    WeakSet = 'WeakSet',
    Array = 'Array',
    Iterable = 'Iterable',
    Map = 'Map',
    Set = 'Set',
    String = 'String',
    Number = 'Number',
    Boolean = 'Boolean',
    Date ='Date',
    Null = 'Null',
    Undefined = 'Undefined',
    Function = 'Function',
    Symbol = 'Symbol',
    Custom = 'Custom'
}

I found these list of names by searching in your source code. even not sure I've found all the cases

@Methuselah96
Copy link
Member

Methuselah96 commented Oct 28, 2020

Yeah, I've definitely planned on doing this. I've been focusing on more of a breadth-first approach to working on the packages in this monorepo and so I haven't gotten around to doing this yet. See #530 for my immediate goals.

Feel free to make a PR for this yourself. If you don't make a PR, I'll get to it eventually, but it's not high on the list of priorities for me at the moment.

On a final note, I prefer string constants instead of enums since it's easier to define a subset of them as a new type and they feel closer to actual JS to me, but I'm not completely against an enum if that's how want to do it.

@paztis
Copy link
Author

paztis commented Oct 28, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants