(type: ts.TypeNode)
| 323 | } |
| 324 | |
| 325 | const applyNullableAndUndefined = (type: ts.TypeNode): ts.TypeNode => { |
| 326 | if (typeInfo.isNullable || typeInfo.isOptional) { |
| 327 | const types: ts.TypeNode[] = [type]; |
| 328 | |
| 329 | if (typeInfo.isNullable) { |
| 330 | types.push(ts.factory.createLiteralTypeNode(ts.factory.createNull())); |
| 331 | } |
| 332 | if (typeInfo.isOptional) { |
| 333 | types.push(ts.factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword)); |
| 334 | } |
| 335 | |
| 336 | return ts.factory.createUnionTypeNode(types); |
| 337 | } |
| 338 | |
| 339 | return type; |
| 340 | }; |
| 341 | |
| 342 | if (typeInfo.unionTypes) { |
| 343 | typeInfo.createTypeNode = () => { |
no test coverage detected