<FromGitter>
<alex-kampa> Is using is_a? the only way?
<FromGitter>
<Blacksmoke16> where is the `nil` coming from?
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<alex-kampa> So I simply added this to convince the compiler: ⏎ ⏎ ```h = h.nil? ? Hash(String, String | Hash(String, String)).new : h``` ⏎ ⏎ I would guess the nil is because the assignment is inside a begin rescue end [https://gitter.im/crystal-lang/crystal?at=60d494e165513b4d912c9448]
<FromGitter>
<Daniel-Worrall> Yes, you need to compile time check nil. ⏎ You can do `h ? not_nil_here : nil_here`
<FromGitter>
<Daniel-Worrall> which is shorthand for `if h` etc.
<FromGitter>
<Daniel-Worrall> This works since it is truthy when not nil
<FromGitter>
<Daniel-Worrall> I'm unsure how this works with compile type of `Bool | Nil`, but I guess it would be true only in the first branch and false | nil in the second
<FromGitter>
<Blacksmoke16> what do you have in the `rescue` portion tho?
<FromGitter>
<Blacksmoke16> sounds like you're just not handling the case where an exception is raised
<FromGitter>
<naqvis> @alex-kampa For your specified use-case, i would suggest to go with `JSON::Serializable` and create a general class, which consumes any json string and returns Hash representation. ⏎ https://play.crystal-lang.org/#/r/bf2a
<FromGitter>
<Daniel-Worrall> While recommendations are appreciated, the nilable hash and original has nothing to do with that. fyi
maria_elis has quit [Ping timeout: 250 seconds]
maria_elis has joined #crystal-lang
_whitelogger has joined #crystal-lang
[RMS] has quit [Client Quit]
repo is now known as Guest1975
snowdrop has joined #crystal-lang
[R] has joined #crystal-lang
f1refly has quit [Ping timeout: 265 seconds]
Guest1975 has quit [Ping timeout: 250 seconds]
f1refly has joined #crystal-lang
Guest1975 has joined #crystal-lang
hightower2 has joined #crystal-lang
<FromGitter>
<watzon> You know how in Crystal you can use a generic like `T` and then use `T.class` to say that you want the class rather than an instance of that class? Any idea how to accomplish the same in Typescript?
DeBot has joined #crystal-lang
hightower2 has quit [Ping timeout: 256 seconds]
<FromGitter>
<szabgab> I have been lurking here for a while, but I guess I should say hi, before I start asking questions. I have been learning Crystal in the last couple of weeks. I started to create a web site collecting data about shards, but then straight-shoota pointed at his shardbox an already existing (and much better looking) system. We then had a live coding session in which he explained about the shardbox and then we even
<FromGitter>
... created a small change. Anyway, I keep learning Crystal and I guess I'll ask some questions here. I hope it is ok even though they will be probably very basic.
<FromGitter>
<Blacksmoke16> o/
maria_elis has quit [Ping timeout: 246 seconds]
maria_elis has joined #crystal-lang
<FromGitter>
<watzon> Welcome @szabgab
<FromGitter>
<ondreian> is everyone just using `minimal` Travis image these days since the `language: crystal` doesn't work?
<FromGitter>
<Blacksmoke16> pretty no one is using travis anymore and just switched to GH Actions
<jhass>
or whatever else, just stopped using travis. They got bought out and basically none of the original open source folks is there anymore
<FromGitter>
<ondreian> I see. `crystal init` still generates a `.travis.yml` file
<FromGitter>
<Blacksmoke16> it wont starting next release
<FromGitter>
<ondreian> cool deal, it had been awhile since I needed to `init` a new project but was kind of 🌽 fused about what was going on. Thanks.