fix(compiler): Update types for TypeScript nullability support
This commit is contained in:
@ -25,7 +25,7 @@ export function main() {
|
||||
ctx.print(createSourceSpan(fileA, 1), 'o1');
|
||||
ctx.print(createSourceSpan(fileB, 0), 'o2');
|
||||
ctx.print(createSourceSpan(fileB, 1), 'o3');
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js').toJSON();
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js').toJSON() !;
|
||||
expect(sm.sources).toEqual([fileA.url, fileB.url]);
|
||||
expect(sm.sourcesContent).toEqual([fileA.content, fileB.content]);
|
||||
});
|
||||
@ -43,7 +43,7 @@ export function main() {
|
||||
it('should be able to shift the content', () => {
|
||||
ctx.print(createSourceSpan(fileA, 0), 'fileA-0');
|
||||
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js', 10).toJSON();
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js', 10).toJSON() !;
|
||||
expect(originalPositionFor(sm, {line: 11, column: 0})).toEqual({
|
||||
line: 1,
|
||||
column: 0,
|
||||
@ -111,9 +111,9 @@ export function main() {
|
||||
// All lines / columns indexes are 0-based
|
||||
// Note: source-map line indexes are 1-based, column 0-based
|
||||
function expectMap(
|
||||
ctx: EmitterVisitorContext, genLine: number, genCol: number, source: string = null,
|
||||
srcLine: number = null, srcCol: number = null) {
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js').toJSON();
|
||||
ctx: EmitterVisitorContext, genLine: number, genCol: number, source: string | null = null,
|
||||
srcLine: number | null = null, srcCol: number | null = null) {
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js').toJSON() !;
|
||||
const genPosition = {line: genLine + 1, column: genCol};
|
||||
const origPosition = originalPositionFor(sm, genPosition);
|
||||
expect(origPosition.source).toEqual(source);
|
||||
@ -123,7 +123,7 @@ function expectMap(
|
||||
|
||||
// returns the number of segments per line
|
||||
function nbSegmentsPerLine(ctx: EmitterVisitorContext) {
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js').toJSON();
|
||||
const sm = ctx.toSourceMapGenerator('o.ts', 'o.js').toJSON() !;
|
||||
const lines = sm.mappings.split(';');
|
||||
return lines.map(l => {
|
||||
const m = l.match(/,/g);
|
||||
|
Reference in New Issue
Block a user