Home / File/ utils.ts — vite Source File

utils.ts — vite Source File

Architecture documentation for utils.ts, a typescript file in the vite codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  0fd78cf0_d1c6_c13e_f7ae_bb75ab308e6a["utils.ts"]
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  0fd78cf0_d1c6_c13e_f7ae_bb75ab308e6a --> 031bc221_67a8_c579_f2bf_bb30a08beeb2
  50c942bf_5ddd_ac2c_f4f6_571d569b7215["mergeWithDefaults"]
  0fd78cf0_d1c6_c13e_f7ae_bb75ab308e6a --> 50c942bf_5ddd_ac2c_f4f6_571d569b7215
  467ed05a_7598_0637_2ccd_6d636455972a["utils"]
  0fd78cf0_d1c6_c13e_f7ae_bb75ab308e6a --> 467ed05a_7598_0637_2ccd_6d636455972a
  style 0fd78cf0_d1c6_c13e_f7ae_bb75ab308e6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/* eslint-disable @typescript-eslint/no-unused-vars */
import type { Equal, ExpectTrue } from '@type-challenges/utils'
import { mergeWithDefaults } from '../utils'

const useDefaultTypeForUndefined1 = mergeWithDefaults(
  {
    foo: 1,
  },
  {},
)

const useDefaultTypeForUndefined2 = mergeWithDefaults(
  {
    foo: 1,
  },
  {
    foo: 2 as number | undefined,
  },
)

const includeKeyNotIncludedInDefault1 = mergeWithDefaults(
  {},
  {
    foo: 2,
  },
)

const extendTypeWithValueType = mergeWithDefaults(
  {
    foo: 1,
  },
  {
    foo: 'string' as string | number,
  },
)

const plainObject = mergeWithDefaults({ foo: { bar: 1 } }, { foo: { baz: 2 } })

const nonPlainObject = mergeWithDefaults(
  { foo: ['foo'] },
  { foo: [0] as number[] | undefined },
)

const optionalNested = mergeWithDefaults({ foo: { bar: true } }, {
  foo: { bar: false },
} as { foo?: { bar?: boolean } })

export type cases1 = [
  ExpectTrue<Equal<typeof useDefaultTypeForUndefined1, { foo: number }>>,
  ExpectTrue<Equal<typeof useDefaultTypeForUndefined2, { foo: number }>>,
  ExpectTrue<Equal<typeof includeKeyNotIncludedInDefault1, { foo: number }>>,
  ExpectTrue<Equal<typeof extendTypeWithValueType, { foo: string | number }>>,
  ExpectTrue<Equal<typeof plainObject, { foo: { bar: number; baz: number } }>>,
  ExpectTrue<Equal<typeof nonPlainObject, { foo: string[] | number[] }>>,
  ExpectTrue<
    Equal<typeof optionalNested, { foo: { bar: boolean } | { bar: boolean } }>
  >,
]

Domain

Types

Dependencies

Frequently Asked Questions

What does utils.ts do?
utils.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain.
What does utils.ts depend on?
utils.ts imports 3 module(s): mergeWithDefaults, utils, utils.ts.
Where is utils.ts in the architecture?
utils.ts is located at packages/vite/src/node/__tests_dts__/utils.ts (domain: ViteCore, directory: packages/vite/src/node/__tests_dts__).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free