-
Notifications
You must be signed in to change notification settings - Fork 89
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
Update typescript examples #539
Conversation
9268963
to
fcee01f
Compare
@@ -28,11 +28,11 @@ const repositoryFactory = new RepositoryFactoryHttp(nodeUrl); | |||
const restrictionHttp = repositoryFactory.createRestrictionAccountRepository(); | |||
|
|||
restrictionHttp.getAccountRestrictions(address) | |||
.subscribe((accountRestrictions) => { | |||
.subscribe((accountRestrictions: any) => { |
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.
Could it be the actual type rather than any
?
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.
What is the actual type? Typescript is still a bit obscure to me.
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.
so it should be the method's return type. AccountRestrictions
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'm afraid my typescript is not strong enough. I have tried with AccountRestrictions
and AccountRestrictions[]
and both failed. Unless you give me more hints, I think I'll use any
(which is what symbol-cli
does).
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.
it should be AccountRestrictions
as the ts sdk defined. what errors have you got?
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.
After changing any
to AccountRestrictions
and adding AccountRestrictions
to the import line:
restriction/GettingAccountRestrictions.ts:32:29 - error TS2339: Property 'length' does not exist on type 'AccountRestrictions'.
32 if (accountRestrictions.length > 0) {
~~~~~~
restriction/GettingAccountRestrictions.ts:34:10 - error TS2339: Property 'filter' does not exist on type 'AccountRestrictions'.
34 .filter((accountRestriction: any) => accountRestriction.values.length > 0)
~~~~~~
source/resources/examples/typescript/aggregate/AddingCosignaturesAggregateComplete.ts
Outdated
Show resolved
Hide resolved
7121b20
to
b8255c3
Compare
0c417f3
to
76a01e3
Compare
Mostly adding epochAdjustment to all transaction.create() calls but there are a few other tweaks too.
Using async await instead of observable's methods for simplicity Removed hardcoded deadline, network type, generation hash, currency information Added eslint and prettier (but not exectued yet)
This is just the result of running "npm run style:fix". No functional changes.
Install node 12 Update sdk version to release 0.22.0 No functional changes.
402a367
to
a3c3f47
Compare
So that all examples fit in the guides without requiring scrollbars, for any screen layout. Now this is enforced by Travis so there's no risk of breaking it in the future.
These are autogenerated using tsc for now.
a3c3f47
to
faa9911
Compare
Mostly adding epochAdjustment to all transaction.create() calls
but there are a few other tweaks too.
Fixes #538