-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented visitTypeAliasDeclaration
- Loading branch information
Andrii Rodionov
committed
Nov 19, 2024
1 parent
42b9fd6
commit d392661
Showing
12 changed files
with
122 additions
and
39 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
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
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
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,69 @@ | ||
import {connect, disconnect, rewriteRun, typeScript} from '../testHarness'; | ||
|
||
describe('type alias mapping', () => { | ||
beforeAll(() => connect()); | ||
afterAll(() => disconnect()); | ||
|
||
test('simple alias', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
type StringAlias = string; | ||
`) | ||
); | ||
}); | ||
|
||
test('simple alias with comments', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
/*a*/type /*b*/ StringAlias /*c*/= /*d*/string /*e*/;/*f*/ | ||
`) | ||
); | ||
}); | ||
|
||
test('function type alias', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
type MyFunctionType = (x: number, y: number) => string; | ||
`) | ||
); | ||
}); | ||
|
||
test('generic type alias', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
type Response<T, R, Y> = (x: T, y: R) => Y;; | ||
`) | ||
); | ||
}); | ||
|
||
test('generic type alias with comments', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
/*a*/type/*b*/ Response/*c*/</*d*/T/*e*/> /*f*/ = /*g*/(x: T, y: number) => string;; | ||
`) | ||
); | ||
}); | ||
|
||
test('union type', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
type ID = /*a*/ number /*b*/ | /*c*/ string /*d*/; | ||
`) | ||
); | ||
}); | ||
|
||
test('union type with comments', () => { | ||
rewriteRun( | ||
//language=typescript | ||
typeScript(` | ||
type ID = number | string; | ||
`) | ||
); | ||
}); | ||
}); |
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
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
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