inferred-types 0.54.2 → 0.54.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8375,6 +8375,14 @@ type _Truncate<TStr extends readonly string[], TMaxLen extends number, TEllipsis
8375
8375
  */
8376
8376
  type Truncate$1<TContent extends string, TMaxLen extends number, TEllipsis extends boolean | string = false> = TContent extends string ? If<IsEqual<TMaxLen, number>, never, If<IsGreaterThan<StrLen<TContent>, TMaxLen>, _Truncate<Chars<TContent>, TMaxLen, Ellipsis<TEllipsis>>, TContent>> : never;
8377
8377
 
8378
+ /**
8379
+ * A string literal which is divided by the `/` character to represent
8380
+ * a Type-and-Subtype relationship.
8381
+ */
8382
+ type TypeSubtype = `${string}/${string}` & {
8383
+ brand: "type-subtype";
8384
+ };
8385
+
8378
8386
  type Process$P<T> = T extends NumberLike ? AsNumber<T> : T extends BooleanLike ? AsBoolean<T> : T;
8379
8387
  /**
8380
8388
  * **UnderlyingType**`<T>`
@@ -9962,11 +9970,12 @@ type FromSimpleToken<T extends SimpleToken> = SimpleType<T>;
9962
9970
  type _FromDefineObject<T extends Required<DefineObject>> = {
9963
9971
  [K in keyof T]: T[K] extends SimpleToken ? FromSimpleToken<T[K]> : T[K] extends ShapeCallback ? FromShapeCallback<T[K]> : never;
9964
9972
  };
9973
+ type TypeFromDefineObject<T> = T;
9965
9974
  /**
9966
9975
  * Converts a `DefineObject` definition into the type that it is
9967
9976
  * defining.
9968
9977
  */
9969
- type FromDefineObject<T extends DefineObject> = MakeKeysOptional<_FromDefineObject<Required<T>>, UnionToTuple$1<OptionalKeys<T>> extends readonly ObjectKey[] ? UnionToTuple$1<OptionalKeys<T>> : never>;
9978
+ type FromDefineObject<T extends DefineObject> = TypeFromDefineObject<MakeKeysOptional<_FromDefineObject<Required<T>>, UnionToTuple$1<OptionalKeys<T>> extends readonly ObjectKey[] ? UnionToTuple$1<OptionalKeys<T>> : never>>;
9970
9979
  /**
9971
9980
  * **FromDefn**`<T, [TElse]>`
9972
9981
  *
@@ -12050,6 +12059,21 @@ declare function ensureSurround<TPrefix extends string, TPostfix extends string>
12050
12059
  */
12051
12060
  declare function ensureTrailing<T extends string, U extends string>(content: T, ensure: U): EnsureTrailing<T, U>;
12052
12061
 
12062
+ /**
12063
+ * **getTypeSubTyp**`(str)`
12064
+ *
12065
+ * Returns a two element tuple representing the `Type` and `SubType`
12066
+ * independantly.
12067
+ *
12068
+ * - can take either a "blessed" `TypeSubtype` as input or any string
12069
+ * literal of `${string}/${string}` but in the latter case if the
12070
+ * string does not pass the isTypeSubtype() test then it will throw
12071
+ * an error (InvalidTypeSubtype).
12072
+ *
12073
+ * **Related:** `TypeSubtype`, `isTypeSubtype`
12074
+ */
12075
+ declare function getTypeSubtype<T extends TypeSubtype | `${string}/${string}`>(str: T): [RetainUntil<T, "/">, RetainAfter<T, "/">];
12076
+
12053
12077
  /**
12054
12078
  * An identity function for any type, with the goal of preserving literal type information
12055
12079
  * where ever possible.
@@ -12814,6 +12838,8 @@ interface TokenFunctionClosure<T extends TypeTokenFunctions, P extends (readonly
12814
12838
  */
12815
12839
  declare function createTypeToken<TBase extends TypeTokenKind>(kind: TBase): VariantClosure<TBase>;
12816
12840
 
12841
+ declare function fromDefineObject<T extends DefineObject>(defn: T): FromDefineObject<T>;
12842
+
12817
12843
  /**
12818
12844
  * **getTokenKind**`(token)`
12819
12845
  *
@@ -13783,6 +13809,13 @@ declare function isTrue(value: unknown): value is true;
13783
13809
  */
13784
13810
  declare function isTruthy<V>(val: V): val is Exclude<V, FalsyValue>;
13785
13811
 
13812
+ /**
13813
+ * type guard which validates whether the `val` passed in is a valid `TypeSubtype`
13814
+ *
13815
+ * **Related:** `TypeSubtype`, `getTypeSubtype()`
13816
+ */
13817
+ declare function isTypeSubtype(val: unknown): val is TypeSubtype;
13818
+
13786
13819
  /**
13787
13820
  * **isTypeTuple**(value)
13788
13821
  *
@@ -14597,4 +14630,4 @@ declare function isYouTubeVideosInPlaylist<T>(val: T): val is T & YouTubeVideosI
14597
14630
  */
14598
14631
  declare function asVueRef<T extends Narrowable>(value: T): VueRef<T>;
14599
14632
 
14600
- export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type EndingWithTypeGuard, type EqualTo, type Finder, type FnParam, type FnParams, type GenParam, type GenParams, type GetEachOptions, type GetInference, type GetOptions, type Joiner, type KeyframeApi, type Rtn, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type TokenContainerClosure, type TokenFunctionClosure, type TokenSetClosure, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createTypeToken, cssColor, csv, defineCss, defineObj, defineObject, defineTuple, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, find, fnMeta, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTokenKind, getTomorrow, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasDefaultValue, hasIndexOf, hasKeys, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, infer, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicKind, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCssAspectRatio, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy, isFnBasedKind, isFnBasedToken, isFnWithParams, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtmlElement, isIkeaUrl, isIndexable, isIndianNewsUrl, isInlineSvg, isIp4Address, isIp6Address, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoTime, isIsoYear, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDateTime, isMacysUrl, isMapToken, isMassMetric, isMassUom, isMetric, isMexicanNewsUrl, isMoment, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistance, isResistanceUom, isRetailUrl, isSameTypeOf, isScalar, isSemanticVersion, isSet, isSetBasedKind, isSetBasedToken, isSetToken, isShape, isShapeCallback, isSimpleContainerToken, isSimpleContainerTokenTuple, isSimpleScalarToken, isSimpleScalarTokenTuple, isSimpleToken, isSimpleTokenTuple, isSingletonKind, isSingletonToken, isSocialMediaProfileUrl, isSocialMediaUrl, isSouthKoreanNewsUrl, isSpanishNewsUrl, isSpecificConstant, isSpeedMetric, isSpeedUom, isString, isStringArray, isSwissNewsUrl, isSymbol, isTailwindColor, isTailwindColorClass, isTailwindColorName, isTailwindColorTarget, isTailwindColorWithLuminosity, isTailwindColorWithLuminosityAndOpacity, isTailwindModifier, isTargetUrl, isTemperatureMetric, isTemperatureUom, isThenable, isThisMonth, isThisWeek, isThisYear, isTimeMetric, isTimeUom, isToday, isTomorrow, isTrimable, isTrue, isTruthy, isTuple, isTupleToken, isTurkishNewsUrl, isTypeOf, isTypeToken, isTypeTokenKind, isTypeTuple, isUkNewsUrl, isUndefined, isUnset, isUom, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsStateAbbreviation, isUsStateName, isVoltageMetric, isVoltageUom, isVolumeMetric, isVolumeUom, isWalgreensUrl, isWalmartUrl, isWayfairUrl, isWholeFoodsUrl, isYesterday, isYouTubeCreatorUrl, isYouTubeFeedHistoryUrl, isYouTubeFeedUrl, isYouTubePlaylistUrl, isYouTubePlaylistsUrl, isYouTubeShareUrl, isYouTubeSubscriptionsUrl, isYouTubeTrendingUrl, isYouTubeUrl, isYouTubeVideoUrl, isYouTubeVideosInPlaylist, isZaraUrl, isZipCode, isZipCode5, isZipPlus4, joinWith, jsonValue, jsonValues, keysOf, kindLiteral, last, list, literal, logicalReturns, lookupCountryAlpha2, lookupCountryAlpha3, lookupCountryCode, lookupCountryName, lowercase, mergeObjects, mergeScalars, mergeTuples, nameLiteral, narrow, never, omit, optional, optionalOrNull, or, orNull, pathJoin, pluralize, removePhoneCountryCode, removeTailwindModifiers, removeUrlProtocol, result, retain, retainAfter, retainAfterInclusive, retainChars, retainUntil, retainUntilInclusive, retainWhile, reverse, rightWhitespace, shape, sharedKeys, shift, simpleContainerToken, simpleContainerTokenToTypeToken, simpleContainerType, simpleScalarToken, simpleScalarTokenToTypeToken, simpleScalarType, simpleToken, simpleType, simpleUnionTokenToTypeToken, slice, split, startsWith, stripAfter, stripBefore, stripChars, stripLeading, stripParenthesis, stripSurround, stripTrailing, stripUntil, stripWhile, surround, takeNumericCharacters, takeProp, toCamelCase, toKebabCase, toNumber, toNumericArray, toPascalCase, toSnakeCase, toString, toUppercase, trim, trimEnd, trimLeft, trimRight, trimStart, truncate, tuple, twColor, unbox, uncapitalize, union, unionize, unique, uniqueKeys, unset, uppercase, urlMeta, valuesOf, widen, withDefaults, withKeys, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };
14633
+ export { type AsClassSelector, type AsList, type BoxValue, type BoxedFnParams, type CssKeyframeCallback, type CssSelectorOptions, type CsvFormat, type EndingWithTypeGuard, type EqualTo, type Finder, type FnParam, type FnParams, type GenParam, type GenParams, type GetEachOptions, type GetInference, type GetOptions, type Joiner, type KeyframeApi, type Rtn, ShapeApiImplementation, type SingletonClosure, type StartingWithTypeGuard, type StripSurroundConfigured, type SurroundWith, type TokenContainerClosure, type TokenFunctionClosure, type TokenSetClosure, type TypeOfTypeGuard, type Unbox, type UndefinedArrayIsUnknown, type UnionClosure, type UrlMeta, type YouTubeMeta, addFnToProps, addPropsToFn, and, asApi, asArray, asChars, asDate, asEscapeFunction, asIsoDate, asOptionalParamFunction, asPhoneFormat, asRecord, asString, asStringLiteral, asType, asTypeToken, asVueRef, box, boxDictionaryValues, capitalize, choices, createConverter, createCssKeyframe, createCssSelector, createErrorCondition, createFifoQueue, createFixedLengthArray, createFnWithProps, createFnWithPropsExplicit, createLifoQueue, createTypeToken, cssColor, csv, defineCss, defineObj, defineObject, defineTuple, endsWith, ensureLeading, ensureSurround, ensureTrailing, entries, errCondition, filter, find, fnMeta, fromDefineObject, get, getDaysBetween, getEach, getPhoneCountryCode, getTailwindModifiers, getToday, getTokenKind, getTomorrow, getTypeSubtype, getUrlPath, getUrlPort, getUrlProtocol, getUrlQueryParams, getUrlSource, getWeekNumber, getYesterday, getYouTubePageType, handleDoneFn, hasDefaultValue, hasIndexOf, hasKeys, hasUrlPort, hasUrlQueryParameter, hasWhiteSpace, idLiteral, idTypeGuard, identity, ifArray, ifArrayPartial, ifBoolean, ifChar, ifContainer, ifDefined, ifFalse, ifFunction, ifHasKey, ifLength, ifLowercaseChar, ifNotNull, ifNull, ifNumber, ifObject, ifSameType, ifScalar, ifString, ifTrue, ifUndefined, ifUppercaseChar, indexOf, infer, intersect, intersection, ip6GroupExpansion, ip6Prefix, isAccelerationMetric, isAccelerationUom, isAlpha, isAmazonUrl, isApi, isApiSurface, isAppleUrl, isAreaMetric, isAreaUom, isArray, isArrayToken, isAtomicKind, isAtomicToken, isAustralianNewsUrl, isBelgiumNewsUrl, isBestBuyUrl, isBitbucketUrl, isBoolean, isBooleanLike, isBox, isCanadianNewsUrl, isChineseNewsUrl, isCodeCommitUrl, isConstant, isContainer, isContainerToken, isCostCoUrl, isCountryAbbrev, isCountryCode2, isCountryCode3, isCountryName, isCssAspectRatio, isCurrentMetric, isCurrentUom, isCvsUrl, isDanishNewsUrl, isDate, isDefineObject, isDefined, isDellUrl, isDistanceMetric, isDistanceUom, isDomainName, isDoneFn, isDutchNewsUrl, isEbayUrl, isEmail, isEnergyMetric, isEnergyUom, isEqual, isErrorCondition, isEscapeFunction, isEtsyUrl, isFalse, isFalsy, isFnBasedKind, isFnBasedToken, isFnWithParams, isFrenchNewsUrl, isFrequencyMetric, isFrequencyUom, isFunction, isGermanNewsUrl, isGithubIssueUrl, isGithubIssuesListUrl, isGithubOrgUrl, isGithubProjectUrl, isGithubProjectsListUrl, isGithubReleaseTagUrl, isGithubReleasesListUrl, isGithubRepoReleaseTagUrl, isGithubRepoReleasesUrl, isGithubRepoUrl, isGithubUrl, isHexadecimal, isHmUrl, isHomeDepotUrl, isHtmlElement, isIkeaUrl, isIndexable, isIndianNewsUrl, isInlineSvg, isIp4Address, isIp6Address, isIpAddress, isIso3166Alpha2, isIso3166Alpha3, isIso3166CountryCode, isIso3166CountryName, isIsoDate, isIsoDateTime, isIsoExplicitDate, isIsoExplicitTime, isIsoImplicitDate, isIsoImplicitTime, isIsoTime, isIsoYear, isItalianNewsUrl, isJapaneseNewsUrl, isKrogersUrl, isLeapYear, isLength, isLikeRegExp, isLowesUrl, isLuminosityMetric, isLuminosityUom, isLuxonDateTime, isMacysUrl, isMapToken, isMassMetric, isMassUom, isMetric, isMexicanNewsUrl, isMoment, isNever, isNewsUrl, isNikeUrl, isNorwegianNewsUrl, isNotNull, isNothing, isNull, isNumber, isNumberLike, isNumericArray, isNumericString, isObject, isObjectToken, isOptionalParamFunction, isPhoneNumber, isPowerMetric, isPowerUom, isPressureMetric, isPressureUom, isReadonlyArray, isRecordToken, isRef, isRegExp, isRepoSource, isRepoUrl, isResistance, isResistanceUom, isRetailUrl, isSameTypeOf, isScalar, isSemanticVersion, isSet, isSetBasedKind, isSetBasedToken, isSetToken, isShape, isShapeCallback, isSimpleContainerToken, isSimpleContainerTokenTuple, isSimpleScalarToken, isSimpleScalarTokenTuple, isSimpleToken, isSimpleTokenTuple, isSingletonKind, isSingletonToken, isSocialMediaProfileUrl, isSocialMediaUrl, isSouthKoreanNewsUrl, isSpanishNewsUrl, isSpecificConstant, isSpeedMetric, isSpeedUom, isString, isStringArray, isSwissNewsUrl, isSymbol, isTailwindColor, isTailwindColorClass, isTailwindColorName, isTailwindColorTarget, isTailwindColorWithLuminosity, isTailwindColorWithLuminosityAndOpacity, isTailwindModifier, isTargetUrl, isTemperatureMetric, isTemperatureUom, isThenable, isThisMonth, isThisWeek, isThisYear, isTimeMetric, isTimeUom, isToday, isTomorrow, isTrimable, isTrue, isTruthy, isTuple, isTupleToken, isTurkishNewsUrl, isTypeOf, isTypeSubtype, isTypeToken, isTypeTokenKind, isTypeTuple, isUkNewsUrl, isUndefined, isUnset, isUom, isUri, isUrl, isUrlPath, isUrlSource, isUsNewsUrl, isUsStateAbbreviation, isUsStateName, isVoltageMetric, isVoltageUom, isVolumeMetric, isVolumeUom, isWalgreensUrl, isWalmartUrl, isWayfairUrl, isWholeFoodsUrl, isYesterday, isYouTubeCreatorUrl, isYouTubeFeedHistoryUrl, isYouTubeFeedUrl, isYouTubePlaylistUrl, isYouTubePlaylistsUrl, isYouTubeShareUrl, isYouTubeSubscriptionsUrl, isYouTubeTrendingUrl, isYouTubeUrl, isYouTubeVideoUrl, isYouTubeVideosInPlaylist, isZaraUrl, isZipCode, isZipCode5, isZipPlus4, joinWith, jsonValue, jsonValues, keysOf, kindLiteral, last, list, literal, logicalReturns, lookupCountryAlpha2, lookupCountryAlpha3, lookupCountryCode, lookupCountryName, lowercase, mergeObjects, mergeScalars, mergeTuples, nameLiteral, narrow, never, omit, optional, optionalOrNull, or, orNull, pathJoin, pluralize, removePhoneCountryCode, removeTailwindModifiers, removeUrlProtocol, result, retain, retainAfter, retainAfterInclusive, retainChars, retainUntil, retainUntilInclusive, retainWhile, reverse, rightWhitespace, shape, sharedKeys, shift, simpleContainerToken, simpleContainerTokenToTypeToken, simpleContainerType, simpleScalarToken, simpleScalarTokenToTypeToken, simpleScalarType, simpleToken, simpleType, simpleUnionTokenToTypeToken, slice, split, startsWith, stripAfter, stripBefore, stripChars, stripLeading, stripParenthesis, stripSurround, stripTrailing, stripUntil, stripWhile, surround, takeNumericCharacters, takeProp, toCamelCase, toKebabCase, toNumber, toNumericArray, toPascalCase, toSnakeCase, toString, toUppercase, trim, trimEnd, trimLeft, trimRight, trimStart, truncate, tuple, twColor, unbox, uncapitalize, union, unionize, unique, uniqueKeys, unset, uppercase, urlMeta, valuesOf, widen, withDefaults, withKeys, withoutKeys, withoutValue, wrapFn, youtubeEmbed, youtubeMeta };