Skip to content

Instantly share code, notes, and snippets.

@DanielHoffmann
Created July 18, 2023 12:13
Show Gist options
  • Select an option

  • Save DanielHoffmann/13acb0f8a56d3fee6af02c073453692d to your computer and use it in GitHub Desktop.

Select an option

Save DanielHoffmann/13acb0f8a56d3fee6af02c073453692d to your computer and use it in GitHub Desktop.

Revisions

  1. DanielHoffmann created this gist Jul 18, 2023.
    19 changes: 19 additions & 0 deletions keys.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@

    type A = {
    a: string
    b: string
    }

    const c = {
    a: 'a',
    b: 'b',
    c: 'c'
    }

    const a: A = c

    Object.entries(a).forEach(([key, value]) => {
    if (key in a) {
    console.log(key)
    }
    })