{"version":3,"file":"non-empty-string.mjs","sources":["../../../../src/predefined/brand/string/non-empty-string.mts"],"sourcesContent":["import { isNonEmptyString } from 'ts-data-forge';\nimport { type NonEmptyString } from 'ts-type-forge';\nimport {\n  string,\n  type StringConstraintsResultType,\n  type StringTypeConstraints,\n} from '../../../primitives/index.mjs';\nimport { type Type } from '../../../type.mjs';\n\nexport type { NonEmptyString } from 'ts-type-forge';\n\n/**\n * The constraints accepted by {@link nonEmptyString}: every {@link string}\n * constraint except `nonempty`, which is always implied.\n */\nexport type NonEmptyStringConstraints = Omit<StringTypeConstraints, 'nonempty'>;\n\nexport function nonEmptyString(defaultValue?: string): Type<NonEmptyString>;\n\nexport function nonEmptyString<const C extends NonEmptyStringConstraints>(\n  defaultValue: string,\n  constraints: C,\n): Type<StringConstraintsResultType<C & Readonly<{ nonempty: true }>>>;\n\nexport function nonEmptyString(\n  defaultValue: string = ' ',\n  constraints?: NonEmptyStringConstraints,\n): Type<NonEmptyString> {\n  // `nonempty` is always implied; the remaining constraints (if any) are\n  // forwarded to `string`, which validates them at runtime and refines the\n  // result type the same way it does for a plain string type.\n  return string(defaultValue, { nonempty: true, ...constraints });\n}\n\nif (import.meta.vitest !== undefined) {\n  test('defaultValue', () => {\n    // eslint-disable-next-line ts-data-forge/no-unnecessary-type-guard\n    assert.isTrue(isNonEmptyString(' '));\n  });\n}\n"],"names":[],"mappings":";;;;;AAwBO,SAAS,cAAA,CACd,YAAA,GAAuB,GAAA,EACvB,WAAA,EACsB;AAItB,EAAA,OAAO,OAAO,YAAA,EAAc,EAAE,UAAU,IAAA,EAAM,GAAG,aAAa,CAAA;AAChE;;;;"}