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

Some interfaces interfere with TS Utility Types #206

Closed
Maxim-Mazurok opened this issue May 29, 2020 · 1 comment · Fixed by #211
Closed

Some interfaces interfere with TS Utility Types #206

Maxim-Mazurok opened this issue May 29, 2020 · 1 comment · Fixed by #211
Labels
bug Something isn't working

Comments

@Maxim-Mazurok
Copy link
Owner

For example:

interface Record {
    /**
     * Key defines all of the unique querying parameters needed to look up a user
     * experience record.
     */
    key?: Key;
    /**
     * Metrics is the map of user experience data available for the record defined
     * in the key field. Metrics are keyed on the metric name.
     *
     * Allowed key values: ["first_contentful_paint",
     * "first_input_delay", "largest_contentful_paint",
     * "cumulative_layout_shift"]
     */
    metrics?: Record<string, Metric>;
}

is generated for gapi.client.chromeuxreport.

interface Record overrides built-in Record<K,T> which results in error Type 'Record' is not generic.

We should check that our interfaces do not override any TS specific terms/words. Utility Types are great starting point. Ideally, we should get these types list from TS dynamically instead of hardcoding.

@Maxim-Mazurok Maxim-Mazurok added the enhancement New feature or request label May 29, 2020
@Maxim-Mazurok
Copy link
Owner Author

Maxim-Mazurok commented May 29, 2020

Actually, we can instead inline Record or any other built-in Utility Types that we use in generated typings: #206

Or, just re-define them with another name.

Downside: we're hard-coding current implementation of Record.

@Maxim-Mazurok Maxim-Mazurok changed the title Don't allow interfaces with names that interfere with TS Utility Types Some interfaces interfere with TS Utility Types May 29, 2020
@Maxim-Mazurok Maxim-Mazurok added bug Something isn't working and removed enhancement New feature or request labels May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant