Skip to content

Error while compiling with version 2.6.4 #28

Closed

Description

@emilianomaccaferri

Hello there,
I just installed the new version and I'm trying to validate this simple schema:

import { enumOf, objectOf, } from "@altostra/type-validations"
import { string } from "@altostra/type-validations/lib/primitives"

type Methods = 'get' | 'post';

export interface HookConfiguration {
    name: string,
    route: string, 
    method: Methods
}

export const validConf = objectOf({
    name: string,
    route: string,
    method: enumOf<Methods>('get', 'post')
})

When I compile the project, the transpiler emits this error:

node_modules/@altostra/type-validations/lib/index.d.ts:2:15 - error TS1005: ',' expected.

2 export { type RejectionsCollector, type ArrayRejectionReasons, type ValidationRejection, CUSTOM_TYPE, createRejectionsCollector, arrayRejectionReasons, asPredicate, mapRejection, setValidatorRejection, typeValidatorType, } from './RejectionReasons';
                ~~~~~~~~~~~~~~~~~~~

node_modules/@altostra/type-validations/lib/index.d.ts:2:41 - error TS1005: ',' expected.

2 export { type RejectionsCollector, type ArrayRejectionReasons, type ValidationRejection, CUSTOM_TYPE, createRejectionsCollector, arrayRejectionReasons, asPredicate, mapRejection, setValidatorRejection, typeValidatorType, } from './RejectionReasons';
                                          ~~~~~~~~~~~~~~~~~~~~~

node_modules/@altostra/type-validations/lib/index.d.ts:2:69 - error TS1005: ',' expected.

2 export { type RejectionsCollector, type ArrayRejectionReasons, type ValidationRejection, CUSTOM_TYPE, createRejectionsCollector, arrayRejectionReasons, asPredicate, mapRejection, setValidatorRejection, typeValidatorType, } from './RejectionReasons';
                                                                      ~~~~~~~~~~~~~~~~~~~

This is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es2020",                                     
    "module": "commonjs",                                
    "rootDir": "./src",                                  
    "outDir": "./build",                                   
    "esModuleInterop": true,                             
    "forceConsistentCasingInFileNames": true,            
    "strict": true,                                      
    "noImplicitAny": true,                            
    "strictNullChecks": true,                         
    "strictFunctionTypes": true,                      
    "strictBindCallApply": true,                      
    "alwaysStrict": true,                             
    "skipLibCheck": true                                 
  }
}


It seems that downgrading to 2.6.1-1 fixes the issue.

Activity

  1. manelcecs commented on Sep 5, 2022

    @manelcecs

    Same here!
    There are errors in the index.d.ts file.

    Any change to get this addressed soon or do we need to downgrade?

  2. ShlomiAltostra commented on Sep 5, 2022

    @ShlomiAltostra
    Contributor

    I apologize for the inconvenience
    This is due to separate type-exports from the "normal" value exports - a feature that adds transparency for which imports are omitted in transpilation and which are transpiled to JS.
    microsoft/TypeScript#45998

    Please update typescript to version 4.5 or above to resolve the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions