-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install TypeScript, add template registry #13
Conversation
This is awesome! Anything that can be done to help move this forward? |
@lukasnys I just need some help installing TypeScript in a V2 addon. Not sure exactly what files and deps are needed |
@charlesfries I couldn't immediately find a list of commands to easily add TypeScript to a V2 addon. I tried using I then took a different approach and I created 2 V2 addons, one with TS and one without. Then I copied over the contents of the one with TS to the other one and created a PR of those changes: https://github.com/lukasnys/addon-v2-to-typescript/pull/1/files. Might be a starting point to getting it working? Though @NullVoxPopuli if you know of a list of commands to setup TS in a V2 addon more easily that would be perfect |
I think if the typescript flag exist in the ember-cli-update.json, ember-cli-update will tell you what to add? Haven't tried, but just an idea. Otherwise, the needed changes are in
|
Pushed a WIP TypeScript installation. This is the issue I'm hitting now:
Tried adding |
in a v2 addon, you need to include the file extensions on the imports, so |
Thanks for the tip. It now seems to build correctly.
|
@@ -1,5 +1,6 @@ | |||
import Ember from 'ember'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be problematic for Ember v7 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should introduce this file yet -- we can't use any of these helpers in JS because they still are wrapped with helper
(to use, we require invokeHelper, which is verbose to use)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI this file already existed, I just converted it to TS. Reverted regardless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some cleanup things to do <3
"concurrently": "^8.2.1", | ||
"ember-source": "~5.8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to install this + webpack
peer to access built-in types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
|
||
export function mapBy([byPath, array]) { | ||
export function mapBy<T extends object>([byPath, array]: [keyof T, T[]]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get
types are slightly different with built-in types--would it be preferable to use a type assertion on the get
args instead of modifying the generic constraint like I've done here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably, ya
@@ -8,6 +8,7 @@ | |||
"lint:css:fix": "concurrently \"npm:lint:css -- --fix\"", | |||
"lint:hbs": "ember-template-lint .", | |||
"lint:js": "eslint .", | |||
"lint:types": "glint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this run in CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't actually see any linting going on in CI -- can you verify that linting and type checking is happening in the workflow files?
thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the lint scripts are actually broken on main (at least on my Windows comp) #19
I added pnpm run lint
to the test app CI job, which should trigger a lint:types
run
.github/workflows/ci.yml
Outdated
@@ -23,6 +23,7 @@ jobs: | |||
- uses: actions/checkout@v4 | |||
- uses: wyvox/action-setup-pnpm@v3 | |||
- run: pnpm build | |||
- run: pnpm run lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put this in its own job above test-default?
and then add the lint command to package.json? 😅
https://github.com/NullVoxPopuli/ember-composable-helpers/pull/13/files#diff-b03f4acb30e04ceb12a40763ef649759b3f632df2357bcec14fab6dd29ebbfb4L5
No description provided.