(col0: number, sourceUrl?: string, sourceLine0?: number, sourceCol0?: number)
| 52 | } |
| 53 | |
| 54 | addMapping(col0: number, sourceUrl?: string, sourceLine0?: number, sourceCol0?: number): this { |
| 55 | if (!this.currentLine) { |
| 56 | throw new Error(`A line must be added before mappings can be added`); |
| 57 | } |
| 58 | if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) { |
| 59 | throw new Error(`Unknown source file "${sourceUrl}"`); |
| 60 | } |
| 61 | if (col0 == null) { |
| 62 | throw new Error(`The column in the generated code must be provided`); |
| 63 | } |
| 64 | if (col0 < this.lastCol0) { |
| 65 | throw new Error(`Mapping should be added in output order`); |
| 66 | } |
| 67 | if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) { |
| 68 | throw new Error(`The source location must be provided when a source url is provided`); |
| 69 | } |
| 70 | |
| 71 | this.hasMappings = true; |
| 72 | this.lastCol0 = col0; |
| 73 | this.currentLine.push({col0, sourceUrl, sourceLine0, sourceCol0}); |
| 74 | return this; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @internal strip this from published d.ts files due to |
no test coverage detected