File tree Expand file tree Collapse file tree 1 file changed +1
-24
lines changed
plugins/typescript/src/core Expand file tree Collapse file tree 1 file changed +1
-24
lines changed Original file line number Diff line number Diff line change 11import { pascal } from "case" ;
22import { SchemaObject } from "openapi3-ts/oas30" ;
33import ts , { factory as f } from "typescript" ;
4+ import { isValidIdentifier } from "tsutils" ;
45import { convertNumberToWord } from "../utils/getEnumProperties" ;
56import { Context , getJSDocComment } from "./schemaToTypeAliasDeclaration" ;
67
7- /**
8- * Function to check if a string is a valid TypeScript identifier
9- *
10- * @param name Name to check
11- */
12- function isValidIdentifier ( name : string ) : boolean {
13- if ( name . length === 0 ) {
14- return false ;
15- }
16-
17- const firstChar = name . charCodeAt ( 0 ) ;
18- if ( ! ts . isIdentifierStart ( firstChar , ts . ScriptTarget . Latest ) ) {
19- return false ;
20- }
21-
22- for ( let i = 1 ; i < name . length ; i ++ ) {
23- if ( ! ts . isIdentifierPart ( name . charCodeAt ( i ) , ts . ScriptTarget . Latest ) ) {
24- return false ;
25- }
26- }
27-
28- return true ;
29- }
30-
318/**
329 * Add Enum support when transforming an OpenAPI Schema Object to Typescript Nodes.
3310 *
You can’t perform that action at this time.
0 commit comments