Disallow group names longer than 32 extended graphemes

This commit is contained in:
Evan Hahn 2021-03-08 16:31:19 -06:00 committed by Josh Perez
parent 934e0fa415
commit ecc04d36de
12 changed files with 302 additions and 46 deletions

27
ts/Intl.d.ts vendored Normal file
View file

@ -0,0 +1,27 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
declare namespace Intl {
type SegmenterOptions = {
granularity?: 'grapheme' | 'word' | 'sentence';
};
type SegmentData = {
index: number;
input: string;
segment: string;
};
interface Segments {
containing(index: number): SegmentData;
[Symbol.iterator](): Iterator<SegmentData>;
}
// `Intl.Segmenter` is not yet in TypeScript's type definitions, so we add it.
class Segmenter {
constructor(locale?: string, options?: SegmenterOptions);
segment(str: string): Segments;
}
}