sinclairzx81 / typebox

Json Schema Type Builder with Static Type Resolution for TypeScript
Other
4.65k stars 150 forks source link

Update string.ts #818

Closed FDiskas closed 4 months ago

FDiskas commented 4 months ago

Migrate to regexp or string type In case it is a string - the developer should add additional escape characters and also can not pass regexp flags

const regex = /^\w(?:[\w-]{0,61}\w)?$/igm;
const regex = new RegExp('^\\w(?:[\\w-]{0,61}\\w)?$', 'igm')

image

But if we change this to RegeXp instead of string - tools will act as it should image