Last active
April 16, 2020 13:30
-
-
Save decadef20/295f4b081f7dfb92010e16b1b7e92f13 to your computer and use it in GitHub Desktop.
Revisions
-
decadef20 revised this gist
Apr 16, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ // how to add ts interface by babel-types const interfaces = path.insertAfter( t.tSInterfaceDeclaration( t.identifier('State'), @@ -11,7 +11,7 @@ const interfaces = path.insertAfter( ) // how to add ts type by babel-types const types = t.typeAlias( t.identifier("State"), t.typeParameterDeclaration( -
decadef20 created this gist
Apr 16, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ // append interface const interfaces = path.insertAfter( t.tSInterfaceDeclaration( t.identifier('State'), null, null, t.tsInterfaceBody( [ t.tsPropertySignature(t.stringLiteral('test'), t.tsTypeAnnotation(t.TSLiteralType(t.stringLiteral('string')))) ] ) ) ) // append type const types = t.typeAlias( t.identifier("State"), t.typeParameterDeclaration( [] // [t.TypeParameter(t.typeAnnotation(t.stringLiteralTypeAnnotation('string')), t.stringLiteralTypeAnnotation('string') , t.variance('plus'))] ), t.objectTypeAnnotation( [ t.ObjectTypeProperty(t.identifier('test'), t.stringLiteralTypeAnnotation('string')) , t.ObjectTypeProperty(t.identifier('aaa'), t.stringLiteralTypeAnnotation('string')) ] ) )