Skip to content
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

refactor(archive,async,cli,csv,dotenv,encoding,expect,fmt,front-matter,fs,http,internal,log,net,path,semver,testing,text,webgpu,yaml): enable "exactOptionalPropertyTypes" option #5892

Merged

Conversation

petamoriken
Copy link
Contributor

Related denoland/deno#25162

By including this PR, users will be able to use std modules without problems when the “exactOptionalPropertyTypes” option (which is recommended in tsconfig reference) is enabled.

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 70.75812% with 81 lines in your changes missing coverage. Please review.

Project coverage is 96.23%. Comparing base (890958c) to head (1e19c5d).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
http/file_server.ts 23.52% 13 Missing ⚠️
fs/walk.ts 50.00% 12 Missing ⚠️
testing/_test_suite.ts 76.47% 12 Missing ⚠️
webgpu/texture_with_data.ts 31.25% 11 Missing ⚠️
fs/expand_glob.ts 50.00% 6 Missing ⚠️
http/_negotiation/media_type.ts 14.28% 6 Missing ⚠️
log/setup.ts 0.00% 4 Missing ⚠️
archive/untar.ts 40.00% 3 Missing ⚠️
csv/stringify_stream.ts 80.00% 2 Missing ⚠️
expect/_build_message.ts 0.00% 2 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5892      +/-   ##
==========================================
- Coverage   96.32%   96.23%   -0.10%     
==========================================
  Files         483      483              
  Lines       39063    39156      +93     
  Branches     5730     5772      +42     
==========================================
+ Hits        37629    37683      +54     
- Misses       1390     1429      +39     
  Partials       44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm for strictness. Though, seeing as tests have to be modified, this seems like a breaking change. WDYT, @kt3k?

@kt3k kt3k changed the title fix: enable "exactOptionalPropertyTypes" option chore: enable "exactOptionalPropertyTypes" option Sep 3, 2024
csv/parse_stream_test.ts Outdated Show resolved Hide resolved
csv/parse_test.ts Outdated Show resolved Hide resolved
csv/parse_test.ts Outdated Show resolved Hide resolved
csv/parse_test.ts Outdated Show resolved Hide resolved
csv/parse_test.ts Outdated Show resolved Hide resolved
Comment on lines 90 to 94
assertEquals(format(-0.4, { locale: undefined } as object), "-0.4 B");
assertEquals(format(0.4, { locale: undefined } as object), "0.4 B");
assertEquals(format(1001, { locale: undefined } as object), "1 kB");
assertEquals(format(10.1, { locale: undefined } as object), "10.1 B");
assertEquals(format(1e30, { locale: undefined } as object), "1000000 YB");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertEquals(format(-0.4, { locale: undefined } as object), "-0.4 B");
assertEquals(format(0.4, { locale: undefined } as object), "0.4 B");
assertEquals(format(1001, { locale: undefined } as object), "1 kB");
assertEquals(format(10.1, { locale: undefined } as object), "10.1 B");
assertEquals(format(1e30, { locale: undefined } as object), "1000000 YB");
assertEquals(format(-0.4, {}), "-0.4 B");
assertEquals(format(0.4, {}), "0.4 B");
assertEquals(format(1001, {}), "1 kB");
assertEquals(format(10.1, {}), "10.1 B");
assertEquals(format(1e30, {}), "1000000 YB");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've placed both { locale: undefined } and {} tests.

fmt/duration_test.ts Outdated Show resolved Hide resolved
@kt3k
Copy link
Member

kt3k commented Sep 3, 2024

Though, seeing as tests have to be modified, this seems like a breaking change.

It seems to me that the changes in test cases are all caused by enabling exactOptionalPropertyTypes because there is no changes in public interfaces.

@github-actions github-actions bot added the async label Sep 3, 2024
@petamoriken
Copy link
Contributor Author

Canary CI failed by denoland/deno#25369

error: TS2724 [ERROR]: 'Deno' has no exported member named 'ServeTlsOptions'. Did you mean 'ServeOptions'?
    | Deno.ServeTlsOptions
           ~~~~~~~~~~~~~~~
    at file:///home/runner/work/std/std/http/file_server.ts:860:12

TS2724 [ERROR]: 'Deno' has no exported member named 'ServeTlsOptions'. Did you mean 'ServeOptions'?
    | (Deno.ServeTlsOptions & Deno.TlsCertifiedKeyOptions) = {
            ~~~~~~~~~~~~~~~
    at file:///home/runner/work/std/std/http/file_server.ts:861:13

Found 2 errors.

@kt3k kt3k changed the title chore: enable "exactOptionalPropertyTypes" option refactor(archive,async,cli,csv,dotenv,encoding,expect,fmt,front-matter,fs,http,internal,log,net,path,semver,testing,text,webgpu,yaml): enable "exactOptionalPropertyTypes" option Sep 4, 2024
@@ -855,21 +856,25 @@ function main() {
console.log(message);
}

// TODO(petamoriken): Migrate `Deno.ServeTcpOptions | (Deno.ServeTcpOptions & Deno.TlsCertifiedKeyOptions)` in v2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean?

Copy link
Contributor Author

@petamoriken petamoriken Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Deno.ServeTlsOptions, but it was renamed to Deno.ServeTcpOptions in Deno v2 (denoland/deno#25369), so I wrote directly this flat type 😭

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k kt3k merged commit 4d4bd0e into denoland:main Sep 4, 2024
17 checks passed
@petamoriken petamoriken deleted the fix/enable-exact-optional-property-types branch September 4, 2024 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants