fix: work around 'noImplicityAny' incompatibility due to ts3.7 update (#34798)
Typescript 3.7 now emits d.ts files for getters differently than prior versions, and there seems to be a bug in how it strips private types without replacing them with explicit 'any' type. This then leads to compilation failures in projects compiled against our packages that don't have skipLibCheck turned on but do have strict or noImplicitAny check on. I'm working around this by marking the affected getters as @internal and adding a test to prevent future regressions. I believe this is a TypeScript bug, and I filed a bug report: https://github.com/microsoft/TypeScript/issues/36216 PR Close #34798
This commit is contained in:
parent
f2a545479d
commit
63c9c2d2be
|
@ -36,6 +36,10 @@ export class EmitterVisitorContext {
|
|||
|
||||
constructor(private _indent: number) { this._lines = [new _EmittedLine(_indent)]; }
|
||||
|
||||
/**
|
||||
* @internal strip this from published d.ts files due to
|
||||
* https://github.com/microsoft/TypeScript/issues/36216
|
||||
*/
|
||||
private get _currentLine(): _EmittedLine { return this._lines[this._lines.length - 1]; }
|
||||
|
||||
println(from?: {sourceSpan: ParseSourceSpan | null}|null, lastPart: string = ''): void {
|
||||
|
@ -169,6 +173,10 @@ export class EmitterVisitorContext {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal strip this from published d.ts files due to
|
||||
* https://github.com/microsoft/TypeScript/issues/36216
|
||||
*/
|
||||
private get sourceLines(): _EmittedLine[] {
|
||||
if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) {
|
||||
return this._lines.slice(0, -1);
|
||||
|
|
|
@ -74,6 +74,10 @@ export class SourceMapGenerator {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal strip this from published d.ts files due to
|
||||
* https://github.com/microsoft/TypeScript/issues/36216
|
||||
*/
|
||||
private get currentLine(): Segment[]|null { return this.lines.slice(-1)[0]; }
|
||||
|
||||
toJSON(): SourceMap|null {
|
||||
|
|
|
@ -351,6 +351,10 @@ export class TestBedRender3 implements TestBed {
|
|||
return fixture;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal strip this from published d.ts files due to
|
||||
* https://github.com/microsoft/TypeScript/issues/36216
|
||||
*/
|
||||
private get compiler(): R3TestBedCompiler {
|
||||
if (this._compiler === null) {
|
||||
throw new Error(`Need to call TestBed.initTestEnvironment() first`);
|
||||
|
@ -358,6 +362,10 @@ export class TestBedRender3 implements TestBed {
|
|||
return this._compiler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal strip this from published d.ts files due to
|
||||
* https://github.com/microsoft/TypeScript/issues/36216
|
||||
*/
|
||||
private get testModuleRef(): NgModuleRef<any> {
|
||||
if (this._testModuleRef === null) {
|
||||
this._testModuleRef = this.compiler.finalize();
|
||||
|
|
Loading…
Reference in New Issue