fork of hey-api/openapi-ts because I need some additional things

Add support for moduleResolution node16 to behave like nodenext

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>

+31 -6
+14
packages/openapi-ts-tests/main/test/clients.test.ts
··· 162 162 { 163 163 config: createConfig({ 164 164 output: { 165 + path: 'tsconfig-node16-sdk', 166 + tsConfigPath: path.join( 167 + __dirname, 168 + 'tsconfig', 169 + 'tsconfig.node16.json', 170 + ), 171 + }, 172 + plugins: [client, '@hey-api/sdk'], 173 + }), 174 + description: 'SDK with Node16 tsconfig', 175 + }, 176 + { 177 + config: createConfig({ 178 + output: { 165 179 importFileExtension: '.ts', 166 180 path: 'import-file-extension-ts', 167 181 },
+9
packages/openapi-ts-tests/main/test/tsconfig/tsconfig.node16.json
··· 1 + { 2 + "extends": "../../../tsconfig.base.json", 3 + "compilerOptions": { 4 + "declaration": false, 5 + "moduleResolution": "node16", 6 + "resolveJsonModule": true, 7 + "skipLibCheck": true 8 + } 9 + }
+4 -2
packages/openapi-ts/src/config/output.ts
··· 50 50 output.tsConfig = loadTsConfig(findTsConfigPath(output.tsConfigPath)); 51 51 if ( 52 52 output.importFileExtension === undefined && 53 - output.tsConfig?.options.moduleResolution === 54 - ts.ModuleResolutionKind.NodeNext 53 + (output.tsConfig?.options.moduleResolution === 54 + ts.ModuleResolutionKind.NodeNext || 55 + output.tsConfig?.options.moduleResolution === 56 + ts.ModuleResolutionKind.Node16) 55 57 ) { 56 58 output.importFileExtension = '.js'; 57 59 }
+4 -4
packages/openapi-ts/src/types/output.d.ts
··· 70 70 /** 71 71 * If specified, this will be the file extension used when importing 72 72 * other modules. By default, we don't add a file extension and let the 73 - * runtime resolve it. If you're using moduleResolution `nodenext`, we 74 - * default to `.js`. 73 + * runtime resolve it. If you're using moduleResolution `nodenext` or 74 + * `node16`, we default to `.js`. 75 75 * 76 76 * @default undefined 77 77 */ ··· 170 170 /** 171 171 * If specified, this will be the file extension used when importing 172 172 * other modules. By default, we don't add a file extension and let the 173 - * runtime resolve it. If you're using moduleResolution `nodenext`, we 174 - * default to `.js`. 173 + * runtime resolve it. If you're using moduleResolution `nodenext` or 174 + * `node16`, we default to `.js`. 175 175 */ 176 176 importFileExtension: ImportFileExtensions | (string & {}) | null | undefined; 177 177 /**