matthewp / corset

Declarative data bindings, bring your own backend.
https://corset.dev/
BSD 2-Clause "Simplified" License
275 stars 2 forks source link

Unable to build with vite and ts #131

Closed Tylopilus closed 2 years ago

Tylopilus commented 2 years ago

At the moment it is not possible to build for production using vite and a local installed version of corset via npm. The issue is happening during typecheck with tsc.

Steps to reproduce:

current result:

❯ npm run build
$ tsc && vite build
node_modules/corset/lib/binding.d.ts:75:53 - error TS2694: Namespace '"/home/projects/vitejs-vite-qczl4g/node_modules/corset/lib/property"' has no exported member 'PropertyPropName'.

75 export type PropertyPropName = import('./property').PropertyPropName;
                                                       ~~~~~~~~~~~~~~~~

node_modules/corset/lib/property.d.ts:26:13 - error TS2456: Type alias 'PropertyDefinition' circularly references itself.

26 export type PropertyDefinition = import('./property').PropertyDefinition;
               ~~~~~~~~~~~~~~~~~~

node_modules/corset/lib/property.d.ts:27:13 - error TS2456: Type alias 'SimplePropertyDefinition' circularly references itself.

27 export type SimplePropertyDefinition = import('./property').SimplePropertyDefinition;
               ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/corset/lib/property.d.ts:28:13 - error TS2456: Type alias 'ShorthandPropertyDefinition' circularly references itself.

28 export type ShorthandPropertyDefinition = import('./property').ShorthandPropertyDefinition;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/corset/lib/property.d.ts:29:13 - error TS2456: Type alias 'LonghandPropertyDefinition' circularly references itself.

29 export type LonghandPropertyDefinition = import('./property').LonghandPropertyDefinition;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/corset/lib/property.d.ts:30:13 - error TS2456: Type alias 'KeyedMultiPropertyDefinition' circularly references itself.

30 export type KeyedMultiPropertyDefinition = import('./property').KeyedMultiPropertyDefinition;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/corset/lib/property.d.ts:31:13 - error TS2456: Type alias 'BehaviorMultiPropertyDefinition' circularly references itself.

31 export type BehaviorMultiPropertyDefinition = import('./property').BehaviorMultiPropertyDefinition;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/main.ts:9:12 - error TS7006: Parameter 'e' implicitly has an 'any' type.

9     toggle(e) {
             ~

Found 8 errors in 3 files.

Errors  Files
     1  node_modules/corset/lib/binding.d.ts:75
     6  node_modules/corset/lib/property.d.ts:26
     1  src/main.ts:9

~/projects/vitejs-vite-qczl4g
matthewp commented 2 years ago

Thanks for filing @Tylopilus, I'll prioritize fixing this.

Correct me if I'm wrong here, but it looks like the issue is unrelated to Vite and is just about running tsc? Is that right?

Tylopilus commented 2 years ago

I did not test it without vite but from the output this is just tsc related, yes.

matthewp commented 2 years ago

I'm able to recreate. Going to make a smoke test to prevent regressions here. Thank you!

matthewp commented 2 years ago

Fixed in https://github.com/matthewp/corset/pull/132, release will go out soon.

matthewp commented 2 years ago

Fixed in 1.0.2