Closed geopic closed 4 years ago
That would be great. This is something I've wanted for a while now but I didn't know how to get started.
Someone just brought this up on Reddit the other day, and I had asked. Is this related to that, or a coincidence?
Assistance would be lovely. Thank you
That would be great. This is something I've wanted for a while now but I didn't know how to get started.
Very well, I'll get started on it soon.
Someone just brought this up on Reddit the other day, and I had asked. Is this related to that, or a coincidence?
Related, I was the OP of that post.
Okay, this is great.
Some things. I'm trying to be helpful, but I don't really know how, so feel free to ask questions.
/src/js
has what I think probably a typescript user would want, the raw source, and the dist folder /dist
has the rollup builds (there's an es6, a cjs es5, an iife es5, plus maps for each.)
/src/js
folder will matter? If that's not correct that's fine, but please help me understandmain
and module
in my package.json
are at least slightly wrong on technicality grounds and I'm worried that'll be germane here
ts
from es6
when there's also present es5
es6
in favor of ts
. I would prefer to allow one to be nominated explicitly as a replacement but I don't know howflow
featureAll you need to do is clone, npm install
, npm run build
You should see around 1200 passing tests
Thank you for any help you're ready to offer 😊
Largely the outside primarily only interacts with sm
and Machine
, and to a much lesser degree make
, compile
, and parse
I think sm
and Machine
will be the hard ones
Machine
is the type for the machine itself. Largely interaction with it is getters and setters
sm
is a tagged template string. Use of it is as follows:
function MakeMyMachine() {
return sm`Red -> Green;`;
}
Not a particularly useful example, but, the tagged template is going to call the hojo of building and compiling for you, so that you can get on with your day
The interface for a tagged template is ... kinda gross, honestly. It's javascript's fault; I didn't choose this.
But if you want a tagged template to consume inclusions, the first argument is the template string broken into pieces as an array, where the interstitials are the inclusion locations like you'd expect, and ...
... and ...
(sorry I get a little choked up thinking about this, big dramatic fake cry scene, oscar nomination)
... and the things to be included aren't in a second array like you'd want at all. They're spread across the remainder as varargs.
so calling
foo`a${1}b${2}c${3}d`
will come into foo/N
as (['a','b','c','d'],1,2,3)
Because I am an upright citizen of good moral character, I've never tried to learn how varargs work in Typescript, and I'm a little worried that just saying the word lowered my credit score
Wow, thank you very much for the help! 😍 It'll all come in very handy, I'm sure.
So I've looked through the files in src/js
, they're a little chaotic and I'm not sure if I should write a definition file if something is going to change. Also on line 287 of jssm_types.ts
, my IDE is telling me JssmCompileSeStart
is not generic. It has a type argument when JssmCompileSeStart
has no type parameter. Should it have one? :confused:
So I've looked through the files in src/js, they're a little chaotic
I'm open to criticism 😄
.
I'm not sure if I should write a definition file if something is going to change.
Other than ripping flow out, and additions, nothing significant has changed in around three years
A lot has been added
I will probably major 6 before I make any significant non-additive changes
.
Also on line 287 of jssm_types.ts, my IDE is telling me JssmCompileSeStart is not generic. It has a type argument when JssmCompileSeStart has no type parameter. Should it have one? 😕
Hm. Yes, it should.
It's not immediately apparent why Typescript isn't balking at that. This was a really old project, that was packaged before the type checkers existed, so Typescript is being invoked through Rollup, which may be tree shaking that out
I should probably invert this to my more common modern structure of separate transpilation steps. I wonder how many other bugs that'll shake out
You need to add a simple and easy API reference of everything the developer can use with this project, the traffic light example is the only accessible thing I can see but even then the properties in the object don't actually exist anywhere in the codebase. Let me know when you have full documentation of everything public and I'll write a types declaration file for it.
Could you just do a couple functions? Then I'll do the rest
I just need to see the basics
nevermind, i'll do it
This is available here by the way, in case someone looks this issue up
So what's the feature?
A type declarations file for TypeScript developers to utilise the power of TS with this module.
Is this related to a problem? If so, what?
Many developers write with TypeScript nowadays so it would be beneficial for them to have the types of returned values, arguments etc be made explicit.
Describe the solution you'd like
An easier time using JSSM for a developer writing with TypeScript! :smile:
Describe alternatives you've considered
N/A
Additional context as you see fit
N/A
If you'd like then I can start on this myself this week. Cheers