shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
fabrao 2020-09-09T17:03:19.205400Z

Hello all, I have this ->

import { Filter, FilterSettingsModel, GridComponent, IFilter, Inject } from '@syncfusion/ej2-react-grids'
with
export default class App extends React.Component<{}, {}>{
public Filter : IFilter = {
    type: 'CheckBox'
  }
  public render() {
      return <GridComponent dataSource={data} filterSettings={this.FilterOptions}
            allowFiltering={true} height={273}>
          <ColumnsDirective>
              <ColumnDirective field='OrderID' width='100' textAlign="Right"/>
              <ColumnDirective field='CustomerID' filter={this.Filter} width='100'/>
              <ColumnDirective field='EmployeeID' width='100' textAlign="Right"/>
              <ColumnDirective field='Freight' width='100' format="C2" textAlign="Right"/>
              <ColumnDirective field='ShipCountry' width='100'/>
          </ColumnsDirective>
          <Inject services={[Filter]} />
      </GridComponent>
  }
}
 How do I use `services={[Filter]}` with CLJS? IFilter interface what?

thheller 2020-09-09T17:04:33.205600Z

hmm is that typescript or what is that?

fabrao 2020-09-09T17:05:21.205800Z

type

lilactown 2020-09-09T17:07:52.206600Z

@fabrao I answered your question in #helix . it’s best not to cross post many channels

thheller 2020-09-09T17:08:01.206800Z

its just #js [#js {:type "CheckBox"}] I presume, not actually a clue if typescripts adds anything

fabrao 2020-09-09T17:08:28.207100Z

many sory

lilactown 2020-09-09T17:08:53.207800Z

assuming that IFilter is a TypeScript interface, they have no runtime

thheller 2020-09-09T17:09:17.208200Z

yes but the import { Filter } confuses me? what is that?

thheller 2020-09-09T17:09:53.208800Z

I'd assume that the public Filter = { type: "CheckBox" } is just regular property syntax?

thheller 2020-09-09T17:10:07.209200Z

I still know next to nothing about typescript though 😛

thheller 2020-09-09T17:10:58.210300Z

@lilactown btw didn't you write something to generate ES class or did you want to do that?

lilactown 2020-09-09T17:10:58.210400Z

ahhh I was thrown off by the indentation, I thought that was a part of the type of App

thheller 2020-09-09T17:11:08.210700Z

I finally broke down and wrote one myself 😛

lilactown 2020-09-09T17:11:43.210900Z

oh yeah? lol

lilactown 2020-09-09T17:11:58.211100Z

this is what I’m using in helix: https://github.com/lilactown/helix/blob/master/src/helix/impl/classes.js

lilactown 2020-09-09T17:12:06.211500Z

it is not great

thheller 2020-09-09T17:12:45.211700Z

(defclass Something
  (extends SomethingElse)
  (field foo 1)
  (field bar)
  
  (constructor [this x]
    (super "foo")
    (set! bar (+ foo x)))
  
  Object
  (someMethod [this foo])
  
  SomeProtocol
  (foo [this bar]))

thheller 2020-09-09T17:13:30.212Z

(Something. 1)

thheller 2020-09-09T17:14:15.213300Z

generates an actual some.ns.Something = class some$ns$Something { constructor(x) { ... }}

lilactown 2020-09-09T17:14:22.213500Z

nice. I like it

lilactown 2020-09-09T17:14:55.214200Z

I had high hopes to create a patch for CLJS to actually emit class but then life happened. I think someone created a library that does it by extending/altering the compiler at a distance

thheller 2020-09-09T17:15:59.214700Z

yeah requires hacking into the compiler quite a bit

thheller 2020-09-09T17:16:26.215400Z

seems to work ok but probably missing a bunch of weird edge cases 😛

thheller 2020-09-09T17:17:39.215800Z

I thought you wrote something like this but I guess I misremembered then?

lilactown 2020-09-09T17:17:46.216100Z

nah it was someone else

thheller 2020-09-09T17:18:53.216400Z

happy that it works at all for now

lilactown 2020-09-09T17:20:20.216900Z

release it as a standalone lib and so I can delete my gross hack in helix 😄

thheller 2020-09-09T17:21:05.217300Z

when I feel semi confident that its correct I'll likely do that

thheller 2020-09-09T17:21:34.217700Z

until then it'll stay in shadow-cljs

lilactown 2020-09-09T17:25:34.218500Z

very nice

lilactown 2020-09-09T17:26:03.219Z

starting to get sick of React’s shit. might give grove a try sometime this year 😂

thheller 2020-09-09T17:26:29.219500Z

got really tired of doing this shit since there was no other way to do stuff in the "constructor"

thheller 2020-09-09T17:27:13.220500Z

stay away from grove for now .. I have a few breaking changes coming up 😉

1
lilactown 2020-09-09T17:28:14.221300Z

I’m not dropping React anytime soon… or ever. I think I really just want something else to do

lilactown 2020-09-09T17:28:41.221500Z

grove looks cool.

thheller 2020-09-09T17:29:13.222400Z

:picard-facepalm:

lilactown 2020-09-09T17:31:20.222600Z

lol

lilactown 2020-09-09T17:31:39.223Z

the positional args for types/records will never not drive me crazy

thheller 2020-09-09T17:37:40.223400Z

typically don't write much of this kind of mutable code but sometimes you just have to 😛

lilactown 2020-09-09T17:44:37.223700Z

yeah there’s a lot of this in a lib i’ve been working on: https://github.com/lilactown/serenity/blob/clj/src/serenity/core.clj#L191