Fork me on GitHub
#shadow-cljs
<
2020-09-09
>
fabrao17:09:19

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?

thheller17:09:33

hmm is that typescript or what is that?

lilactown17:09:52

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

thheller17:09:01

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

lilactown17:09:53

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

thheller17:09:17

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

thheller17:09:53

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

thheller17:09:07

I still know next to nothing about typescript though 😛

thheller17:09:58

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

lilactown17:09:58

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

thheller17:09:08

I finally broke down and wrote one myself 😛

lilactown17:09:43

oh yeah? lol

lilactown17:09:06

it is not great

thheller17:09:45

(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]))

thheller17:09:30

(Something. 1)

thheller17:09:15

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

lilactown17:09:22

nice. I like it

lilactown17:09:55

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

thheller17:09:59

yeah requires hacking into the compiler quite a bit

thheller17:09:26

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

thheller17:09:39

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

lilactown17:09:46

nah it was someone else

thheller17:09:53

happy that it works at all for now

lilactown17:09:20

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

thheller17:09:05

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

thheller17:09:34

until then it'll stay in shadow-cljs

lilactown17:09:03

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

thheller17:09:29

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

thheller17:09:13

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

3
lilactown17:09:14

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

lilactown17:09:41

grove looks cool.

lilactown17:09:39

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

thheller17:09:40

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

lilactown17:09:37

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