This repository has been archived by the owner on Dec 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pass ts.Program as an argument for getCustomTransformers (#594)
* feat: pass ts.Program as an argument for getCustomTransformers * docs: add an explanation for getCustomTransformers
- Loading branch information
1 parent
e1e95b1
commit c0d10bf
Showing
4 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {src, webpackConfig, tsconfig, compile, checkOutput, expectErrors, spec, expect, query} from './utils' | ||
|
||
[true, false].forEach(transpileOnly => { | ||
spec(`${__filename}-transpileOnly:${transpileOnly}`, async function() { | ||
src( | ||
'index.ts', | ||
` | ||
class HiThere { | ||
constructor(a: number, b: string) { | ||
const t = a + b; | ||
} | ||
} | ||
` | ||
) | ||
|
||
tsconfig() | ||
let getCustomTransformersCalled = false | ||
let stats = await compile(webpackConfig(query({ | ||
transpileOnly, | ||
getCustomTransformers: program => { | ||
expect(typeof program.getTypeChecker === 'function').true | ||
getCustomTransformersCalled = true | ||
return {}; | ||
} | ||
}))) | ||
|
||
expectErrors(stats, 0) | ||
checkOutput( | ||
'index.js', | ||
` | ||
class HiThere { | ||
constructor(a, b) { | ||
const t = a + b; | ||
} | ||
} | ||
` | ||
) | ||
expect(getCustomTransformersCalled).true | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters