fix(compiler): Update types for TypeScript nullability support
This commit is contained in:
@ -274,7 +274,7 @@ export function main() {
|
||||
it('should throw an error if a selector is being parsed while in the wrong mode', () => {
|
||||
const cssCode = '.class > tag';
|
||||
|
||||
let capturedMessage: string;
|
||||
let capturedMessage: string = undefined !;
|
||||
try {
|
||||
tokenize(cssCode, false, CssLexerMode.STYLE_BLOCK);
|
||||
} catch (e) {
|
||||
@ -282,7 +282,7 @@ export function main() {
|
||||
}
|
||||
|
||||
expect(capturedMessage).toMatch(/Unexpected character \[\>\] at column 0:7 in expression/g);
|
||||
capturedMessage = null;
|
||||
capturedMessage = null !;
|
||||
|
||||
try {
|
||||
tokenize(cssCode, false, CssLexerMode.SELECTOR);
|
||||
|
@ -111,26 +111,26 @@ export function main() {
|
||||
expect(ast.rules.length).toEqual(1);
|
||||
|
||||
const rule = <CssKeyframeRuleAst>ast.rules[0];
|
||||
expect(rule.name.strValue).toEqual('rotateMe');
|
||||
expect(rule.name !.strValue).toEqual('rotateMe');
|
||||
|
||||
const block = <CssBlockAst>rule.block;
|
||||
const fromRule = <CssKeyframeDefinitionAst>block.entries[0];
|
||||
|
||||
expect(fromRule.name.strValue).toEqual('from');
|
||||
expect(fromRule.name !.strValue).toEqual('from');
|
||||
const fromStyle = <CssDefinitionAst>(<CssBlockAst>fromRule.block).entries[0];
|
||||
expect(fromStyle.property.strValue).toEqual('transform');
|
||||
assertTokens(fromStyle.value.tokens, ['rotate', '(', '-360', 'deg', ')']);
|
||||
|
||||
const midRule = <CssKeyframeDefinitionAst>block.entries[1];
|
||||
|
||||
expect(midRule.name.strValue).toEqual('50%');
|
||||
expect(midRule.name !.strValue).toEqual('50%');
|
||||
const midStyle = <CssDefinitionAst>(<CssBlockAst>midRule.block).entries[0];
|
||||
expect(midStyle.property.strValue).toEqual('transform');
|
||||
assertTokens(midStyle.value.tokens, ['rotate', '(', '0', 'deg', ')']);
|
||||
|
||||
const toRule = <CssKeyframeDefinitionAst>block.entries[2];
|
||||
|
||||
expect(toRule.name.strValue).toEqual('to');
|
||||
expect(toRule.name !.strValue).toEqual('to');
|
||||
const toStyle = <CssDefinitionAst>(<CssBlockAst>toRule.block).entries[0];
|
||||
expect(toStyle.property.strValue).toEqual('transform');
|
||||
assertTokens(toStyle.value.tokens, ['rotate', '(', '360', 'deg', ')']);
|
||||
@ -695,7 +695,7 @@ export function main() {
|
||||
const ast = output.ast;
|
||||
|
||||
assertMatchesOffsetAndChar(ast.location.start, 0, '#');
|
||||
assertMatchesOffsetAndChar(ast.location.end, 22, undefined);
|
||||
assertMatchesOffsetAndChar(ast.location.end, 22, undefined !);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -257,7 +257,7 @@ export function main() {
|
||||
expect(captures.length).toEqual(1);
|
||||
|
||||
const keyframe1 = <CssKeyframeRuleAst>_getCaptureAst(captures, 0);
|
||||
expect(keyframe1.name.strValue).toEqual('rotate');
|
||||
expect(keyframe1.name !.strValue).toEqual('rotate');
|
||||
expect(keyframe1.block.entries.length).toEqual(2);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user