Exporting a declaration
Any declaration (such as a variable, function, class, type alias, or interface) can be exported by adding the export
keyword.
Validation.ts
export interface StringValidator { isAcceptable(s: string): boolean; }
ZipCodeValidator.ts
export const numberRegexp = /^[0-9]+$/; export class ZipCodeValidator implements StringValidator { isAcceptable(s: string) { return s.length === 5 && numberRegexp.test(s); } }
Please login to continue.