From 458fdb45a884a9370c29404f2952703c091bd739 Mon Sep 17 00:00:00 2001 From: Alessandro Scandone Date: Thu, 8 Feb 2024 22:21:29 +0100 Subject: [PATCH] updated typescript version --- package.json | 2 +- src/decoder.ts | 6 +++--- src/internals/xml.ts | 4 ++-- tsconfig.json | 20 ++++++++++---------- yarn.lock | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 1403275..a9c8535 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "runtypes": "^6.5.0", "ts-node": "^10.4.0", "typedoc": "^0.22.10", - "typescript": "^4.5.2", + "typescript": "^5.3.3", "vitest": "^1.2.2", "zod": "^3.11.6" } diff --git a/src/decoder.ts b/src/decoder.ts index fac392d..a04c570 100644 --- a/src/decoder.ts +++ b/src/decoder.ts @@ -485,7 +485,7 @@ class ObjectDecoder extends Decoder< const returnObject: any = {}; for (const field in specs) { - const fieldSpec = specs[field]; + const fieldSpec = specs[field]!; const decoder = fieldSpec.decoder; @@ -640,8 +640,8 @@ export function tuple[]>( } for (let index = 0; index < decoders.length; index++) { - const decoder = decoders[index]; - const arrayValue = value[index]; + const decoder = decoders[index]!; + const arrayValue = value[index]!; const result = decoder.decode(arrayValue); diff --git a/src/internals/xml.ts b/src/internals/xml.ts index 896b655..419134e 100644 --- a/src/internals/xml.ts +++ b/src/internals/xml.ts @@ -39,8 +39,8 @@ export const xmlToStringHelper = (level: number, xml: Xml): string => { if (children.length === 0) { return indentationTag + `<${tag}${attrsSpace}${strAttrs} />`; - } else if (children.length === 1 && children[0].type === "text") { - const child = children[0].value; + } else if (children.length === 1 && children[0]!.type === "text") { + const child = children[0]!.value; return `${indentationTag}<${tag}${attrsSpace}${strAttrs}> ${child} `; } else { // Uppper diff --git a/tsconfig.json b/tsconfig.json index 02416e7..1be4746 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ES2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "ES2015" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -25,10 +25,10 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ /* Modules */ - + // "module": "ESNext", /* Specify what module code is generated. */ // "rootDir": "./src", /* Specify the root folder within your source files. */ - "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ @@ -44,8 +44,8 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, + "declarationMap": true /* Create sourcemaps for d.ts files. */, // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ @@ -71,12 +71,12 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ + "strict": true /* Enable all strict type-checking options. */, // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ @@ -90,7 +90,7 @@ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + "noUncheckedIndexedAccess": true /* Include 'undefined' in index signature results */, // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ @@ -98,6 +98,6 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ } } diff --git a/yarn.lock b/yarn.lock index 6fe4921..d380dfa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1549,10 +1549,10 @@ typedoc@^0.22.10: minimatch "^3.0.4" shiki "^0.9.12" -typescript@^4.5.2: - version "4.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.3.tgz#afaa858e68c7103317d89eb90c5d8906268d353c" - integrity sha512-eVYaEHALSt+s9LbvgEv4Ef+Tdq7hBiIZgii12xXJnukryt3pMgJf6aKhoCZ3FWQsu6sydEnkg11fYXLzhLBjeQ== +typescript@^5.3.3: + version "5.3.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" + integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== ufo@^1.3.2: version "1.4.0"