Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
type CrewMember = Static<
typeof CrewMember
>; /* = {
name: string;
age: NonNegative;
rank: Rank;
home: Planet;
}*/
const Ship = Record({
type: Literal('ship'),
location: Vector,
mass: NonNegative,
name: String,
crew: Array(CrewMember),
});
type Ship = Static<
typeof Ship
>; /* = {
type: 'ship';
location: Vector;
mass: NonNegative;
name: string;
crew: CrewMember[];
}*/
const Fleet = Dictionary(Ship, 'number');
type Fleet = Static; // = { [_: number]: Ship }
const SpaceObject = Union(Asteroid, Planet, Ship);
type SpaceObject = Static; // = Asteroid | Planet | Ship
files: Array(FilesRuntime),
})
export const StatisticRuntime = Record({
statisticName: String,
value: Number,
})
export const ExtensionRuntime = Record({
extensionId: String,
extensionName: String,
lastUpdated: String,
publishedDate: String,
releaseDate: String,
publisher: PublisherRuntime,
versions: Array(VersionRuntime),
statistics: Array(StatisticRuntime),
}).And(
// Optional properties.
Partial({
displayName: String,
shortDescription: String,
}),
)
export const ExtensionQueryResultsRuntime = Record({
results: Tuple(Record({ extensions: Array(ExtensionRuntime) })),
})
export const ScrapeExtensionsPayloadRuntime = Record({
page: Number,
})
type,
members: ArrayWithContains(Array(Member), Spouse, countSpouse)
})
const FamilyWithSpouse = FamilyWithTypeAndMember(
Literal('espoused'),
1
)
const FamilyWithoutSpouse = FamilyWithTypeAndMember(
Union(
Literal('single'),
Literal('common_law_marriage'),
Void
),
0
)
const membersWithSpouse = ArrayWithContains(Array(Member), Spouse, 1)
const FamilyObject = Union(FamilyWithSpouse, FamilyWithoutSpouse)
test('Fio', generateAndCheck(Fio))
test('Member', generateAndCheck(Member))
test('Member', generateAndCheck(Member))
test('MemberWithSpouse', generateAndCheck(membersWithSpouse))
test('FamilyWithSpouse', generateAndCheck(FamilyWithSpouse))
test('FamilyWithoutSpouse', generateAndCheck(FamilyWithoutSpouse))
test('FamilyObject', generateAndCheck(FamilyObject))
});
const FamilyWithTypeAndMember = (type, countSpouse) => Record({
type,
members: ArrayWithContains(Array(Member), Spouse, countSpouse)
})
const FamilyWithSpouse = FamilyWithTypeAndMember(
export const LineTokenRuntime = Record({
token: String,
style: Partial({
color: String,
fontWeight: String,
fontStyle: String,
textDecoration: String,
}),
})
export const LineTokensRuntime = Array(LineTokenRuntime)
export const LanguageTokensRuntime = Record({
javascript: Array(LineTokensRuntime),
html: Array(LineTokensRuntime),
css: Array(LineTokensRuntime),
})
export const SaveThemePayloadRuntime = ExtractThemesPayloadRuntime.And(
Record({
themeId: String,
themeName: String,
themeType: ThemeTypeRuntime,
colors: ColorsRuntime,
languageTokens: LanguageTokensRuntime,
}),
)