anyone know what’s up with intellisense in SST pro...
# help
anyone know what’s up with intellisense in SST projects?
doesn’t show up as a property, but it should be. this might be a VS Code bug, seems like
Hmm.. I’ve seen a similar weird issue with IntelliSense
weird. mind if I add my case to that issue, since it could be related?
For sure!
I wasn’t able to figure it out when I last looked… probably I don’t know enough about it
If u have any hint.. lemme know… I will take another crack at it
I left a comment explaining it
The solution involves switching to a pattern called algebraic data types which are really really powerful but the apis might feel a bit more verbose
Ah I see… do you have an example of the syntax? just to get a taste of how verbose it is 😅
Basically the gist is to be able to identify the specific type inside a union type, you need a way to "discriminate" between them. So all the types need a common field that can serve as the discriminator
Copy code
type Rectangle = {
  kind: "square";
  width: number;
  height: number;

type Circle = {
  kind: "circle";
  radius: number;

type Shape = Rectangle | Circle

function test(s: Shape) {
  console.log(s.height) // type error
  if (s.kind === "square") {
    s.height // valid
tsc is pretty smart about identifying these discriminators and using them to hint things to you
It lets you write really bullet proof code but you need to add discriminators everywhere
^ it omits
because it knows that's not what you want
Oh nice.. I kinda like that 😂
I like it too, we can use it with
as well and have very nice developer experience where it shows them what options are available for a python bundle vs a go bundle
A problem with CDK so far is that the
check is not reliable. ie. SST has the
dependency, and users can also have
as their dependency. If they are of different versions, the package is going to appear twice in side
can peer dependencies help there?
use their version if available
Yeah we looked into that briefly.. forgot what the problem was. Yeah should look into it again.