Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while compiling with version 2.6.4 #28

Closed
emilianomaccaferri opened this issue Aug 22, 2022 · 2 comments
Closed

Error while compiling with version 2.6.4 #28

emilianomaccaferri opened this issue Aug 22, 2022 · 2 comments

Comments

@emilianomaccaferri
Copy link

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.

@manelcecs
Copy link

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

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

@ShlomiAltostra
Copy link
Contributor

ShlomiAltostra commented Sep 5, 2022

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
Labels
None yet
Development

No branches or pull requests

3 participants