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

refactor(yaml): make Type generic #5394

Merged
merged 8 commits into from
Jul 11, 2024

Conversation

timreichen
Copy link
Contributor

  • adds generic to Type
  • removes some any types

@timreichen timreichen requested a review from kt3k as a code owner July 10, 2024 19:14
@github-actions github-actions bot added the yaml label Jul 10, 2024
Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.36%. Comparing base (10bcb95) to head (bc3e3d4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5394   +/-   ##
=======================================
  Coverage   96.35%   96.36%           
=======================================
  Files         458      458           
  Lines       37729    37726    -3     
  Branches     5576     5576           
=======================================
  Hits        36353    36353           
+ Misses       1334     1331    -3     
  Partials       42       42           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iuioiua iuioiua changed the title refactor(yaml): add generic to Type refactor(yaml): make Type generic Jul 11, 2024
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Couple of nits.

yaml/_schema.ts Outdated Show resolved Hide resolved
yaml/_type.ts Show resolved Hide resolved
yaml/_type.ts Outdated Show resolved Hide resolved
@@ -5,8 +5,7 @@

import type { Type } from "../_type.ts";

// deno-lint-ignore no-explicit-any
function resolveYamlSet(data: any): boolean {
function resolveYamlSet(data: Record<PropertyKey, unknown>): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function resolveYamlSet(data: Record<PropertyKey, unknown>): boolean {
function resolveYamlSet(data: ResultType | null): boolean {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that doesn't work, because result type could also be an object or string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should revert this to any as we don't know what types are actually passed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must be an object or for (const key in data) {...} would throw no?

@iuioiua iuioiua requested a review from kt3k July 11, 2024 07:57
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k kt3k merged commit 24c7dc3 into denoland:main Jul 11, 2024
16 checks passed
@timreichen timreichen deleted the yaml-add-generic-to-Type branch August 17, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants