Changelog - 2026-10-26
String options are const classes, and dev-configs warns on string-literal unions and casts
Enhancement Behavior ChangeIn one line. Options typed as a union of string literals are now a const class plus a TConstValue type, like RepositoryTypes, and @venizia/dev-configs warns when you write such a union or an as X cast yourself. The values and defaults are the same, so existing code keeps compiling and no lint fails.
What changed
- Each class has
SCHEME_SETandisValid(value), so a value read from config or a request can be checked at runtime. - The literal still works.
{ from: 'header', key: 'x-m', type: 'Merchant' },{ type: 'strings' },{ numberMode: 'bigint' }andEqeqeqRule.build({ mode: 'always' })compile as before; so does the class value (AuthorizationDomainSources.HEADER,BigIntModes.BIGINT). - The id-type options use
TIdSchemaType(numberorstring) from the kernel package:polymorphicIdTypeand theIdTypegenerics ofenrichPrincipalandgeneratePrincipalColumnDefs, thedataTypeof the user-audit enricher, and the id-type options of the server models (extraUserColumns, the permission and policy-definition options).TIdSchemaTypeis nowTConstValue<typeof IdSchemaTypes>. TJWKSAlgorithmandTIdSchemaTypemoved files, not names: both are exported from the same package entries as before.TConstValue<T>is exported from the dev-configs rules entry.
| Package | Option | Const class | Type |
|---|---|---|---|
| kernel | ICompressOptions.encoding | CompressEncodings | TCompressEncoding |
| kernel | IJWKSIssuerOptions.algorithm | JWKSAlgorithms | TJWKSAlgorithm |
| kernel | IAuthorizationDomainSource.from | AuthorizationDomainSources | TAuthorizationDomainSource |
| kernel | registerRoutesFromRegistry({ paths }) | RoutePathScopes | TRoutePathScope |
| kernel | AbstractEntity.getIdType() | IdSchemaTypes | TIdSchemaType |
| kernel | getAuthorizeModelPrincipals({ format }), getAuthorizeModelSettings({ format }) | AuthorizeModelFormats | TAuthorizeModelFormat |
| connectors | HTTP read({ shape }) | HttpReadShapes | THttpReadShape |
| connectors | Scope write guard operation | ScopeWriteOperations | TScopeWriteOperation |
| connectors | big-number id numberMode (Postgres) | BigIntModes | TBigIntMode |
| inversion | ApplicationError logLevel | ErrorLogLevels | TErrorLogLevel |
| helpers | High-frequency logger level | LogLevels (already existed) | THfLogLevel |
| helpers | IFieldMapping.type | FieldMappingDataTypes | TFieldMappingDataType |
| helpers | AES cipher | AESAlgorithms | AESAlgorithmType |
| helpers | pino file roll frequency | PinoFrequencies | TFrequency |
| helpers | Fetcher client | FetcherVariants | TFetcherVariant |
| helpers | BullMQ helper role | BullQueueRoles | TBullQueueRole |
| helpers | TCP client state | TcpClientStates | TTcpClientState |
| helpers | Kafka consumer, why every broker is gone | KafkaBrokersDownReasons | TKafkaBrokersDownReason |
| helpers | createContentDispositionHeader({ type }) | ContentDispositionTypes | TContentDispositionType |
| helpers | parseMultipartBody({ storage }), static-asset upload storage | MultipartStorages | TMultipartStorage |
| helpers | Locale month and weekday name width | TemporalNameWidths | TTemporalNameWidth |
| helpers | Locale writtenDate style | TemporalWrittenDateStyles | TTemporalWrittenDateStyle |
| helpers | Pattern dialect tokens | PatternTokens | TPatternToken, TWriteOnlyToken |
| server | Mail queue backoff.type | MailBackoffTypes | TMailBackoffType |
| dev-configs | severity of every rule builder | RuleSeverities | TRuleSeverity |
| dev-configs | EqeqeqRule.build({ mode }) | EqeqeqModes | TEqeqeqMode |
| dev-configs | NoUnusedVarsRule.build({ vars }) | UnusedVarsScopes | TUnusedVarsScope |
| dev-configs | NoUnusedVarsRule.build({ args }) | UnusedArgsModes | TUnusedArgsMode |
| dev-configs | SwitchCaseBracesRule.build({ mode }) | SwitchCaseBracesModes | TSwitchCaseBracesMode |
New lint warnings
After updating @venizia/dev-configs, houseConfigs and reactHouseConfigs print warnings that never fail the lint. Tests are exempt.
warning An enumerable string is a const class plus TConstValue<typeof X>, not a union of string literals venizia/const-class-values
warning Do not use any type assertions @typescript-eslint/consistent-type-assertionsvenizia/const-class-valuesis on, atwarn. It used to be off and checked only exported types named*State,*Status,*Stage,*Mode,*Kindor*Type. It now checks every exported declaration: a type alias, an interface member, a generic constraint, a parameter or a return type. Fix a hit with a const class andTConstValue.- Key sets are skipped.
Pick<T, 'a' | 'b'>,Omit,Extract,Exclude,Recordand mapped-type keys are not value domains, and a union with a non-string member is not either. @typescript-eslint/consistent-type-assertionsis on, atwarn, withassertionStyle: 'never'.as X,as anyandas unknown as Xwarn.as constandsatisfiesdo not.ConstClassValuesRule.build({ namePattern })is optional. Without it the rule checks every exported declaration. PassnamePatternto keep the old narrow behavior.
Who is affected
Nobody has to change code. Prefer the class value in new code: RoutePathScopes.PARAM over 'param'. Apps and libraries that lint with houseConfigs or reactHouseConfigs see new warnings. To stay quiet, turn a rule off after the preset; to make one a failure, set it to 'error' the same way:
import { houseConfigs } from '@venizia/dev-configs/linters';
export default [
...houseConfigs,
{ rules: { 'venizia/const-class-values': 'off', '@typescript-eslint/consistent-type-assertions': 'off' } },
];