Skip to content

Translate primitives any of playground examples into japanese #244

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

Merged

Conversation

takefumi-yoshii
Copy link
Contributor

Overview

part of #100, #220

I translated Primitives Any playground-example.

@Naturalclar @Quramy @sasurau4 Please give me a review.

image

// JavaScriptの様に動的に扱ったり、
// 型システムの制限を回避することができます。

// any型を利用する良いケースはJSON parsingです
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'm not confident here...

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO: 「JSONのparseです」が良さそう

Copy link
Contributor

Choose a reason for hiding this comment

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

ここでのanyは推論されているものなので、「使用されている」のほうが自然かもしれません。

Suggested change
// any型を利用する良いケースはJSON parsingです
// any型が使用されている良い例はJSON.parseの結果です

// any型を利用することで、型安全のトレードオフと引き換えに、
// よりオリジナルに近いJavaScriptコードを書くことができます。

// any型は、どんな型でも(neverを除いた)割り当て可能であり、
Copy link
Contributor

Choose a reason for hiding this comment

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

[imo] 括弧はあってもなくても成立する文章にしたいです

Suggested change
// any型は、どんな型でも(neverを除いた)割り当て可能であり
// any型は、(neverを除いて)どんな型でも割り当て可能であり

Copy link
Contributor Author

Choose a reason for hiding this comment

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

コメントありがとうございます!該当箇所を修正しました

// JavaScriptの様に動的に扱ったり、
// 型システムの制限を回避することができます。

// any型を利用する良いケースはJSON parsingです
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO: 「JSONのparseです」が良さそう


// TypeScriptにおけるAny宣言は、あなたがその値について詳しく知っていて
// 安全なものなので信じてください、という宣言です。
// それが厳密に正しくない場合でも。例えば、次のコードはクラッシュします。
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO: 原文的にはこの並びなんですが、日本語としてはこなれていないので、ちょっと語順をいじるとこなれていい感じになると思います

// TypeScriptにおけるAny宣言は、あなたがその値について詳しく知っていて
// それが厳密に正しくないとしても、安全なものなので信じてくださいという宣言です。
// 例えば、次のコードはクラッシュします。

@@ -0,0 +1,51 @@
// AnyはTypeScriptのエスケープ句です。
Copy link
Contributor

Choose a reason for hiding this comment

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

Anyかanyか統一した方がいいかも?

Copy link
Contributor

Choose a reason for hiding this comment

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

any で統一しましょうか、実際にコードで使うのは any ですし


myObject.x.y.z;

// any型を利用することで、型安全のトレードオフと引き換えに、
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO: with the trade offで「引き換えに」になるのでトレードオフはなくても良さそう

Suggested change
// any型を利用することで、型安全のトレードオフと引き換えに
// any型を利用することで、型安全性と引き換えに

// タプル型が初見の場合、example:tuples を参照してください。

// unknown型はany型の兄弟とも言うことができますが、
// any型は「最善策を知っています」という場合に利用する一方で、
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO:

Suggested change
// any型は「最善策を知っています」という場合に利用する一方で
// any型は「最善策を知っている」場合に利用する一方で

// unknown型はany型の兄弟とも言うことができますが、
// any型は「最善策を知っています」という場合に利用する一方で、
// unknown型は「最善策が分からないので、TSに型を伝える必要があります」
// という場合に利用します。
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO:
// unknown型は「最善策が分からないので、TSに型を伝える必要がある」
// 場合に利用します。


const myObject = JSON.parse("{}");

// TypeScriptにおけるAny宣言は、あなたがその値について詳しく知っていて
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// TypeScriptにおけるAny宣言は、あなたがその値について詳しく知っていて
// TypeScriptにおけるany宣言は、あなたがその値について詳しく知っていて

// any型は「最善策を知っています」という場合に利用する一方で、
// unknown型は「最善策が分からないので、TSに型を伝える必要があります」
// という場合に利用します。

Copy link
Contributor

@Naturalclar Naturalclar Feb 12, 2020

Choose a reason for hiding this comment

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

[imo]原文はここに改行が無いので、それに合わせたいです。(原文に変更があった時にDiffをスムーズに受け入れられるように。)

Suggested change

@takefumi-yoshii
Copy link
Contributor Author

@Naturalclar @sasurau4 ご指摘ありがとうございますー。修正しましたので再度ご確認お願いします 🙏

Copy link
Contributor

@sasurau4 sasurau4 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Naturalclar Naturalclar left a comment

Choose a reason for hiding this comment

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

Ready to merge

@orta
Copy link
Contributor

orta commented Feb 13, 2020

Ready to merge

@orta
Copy link
Contributor

orta commented Feb 14, 2020

OK, I've validated all the CI autp-merge stuff - it's looking right except I'm waiting on the typescript bot getting access to the repo

(It only does issue comments, but not review comments yet, will add that )

@orta orta merged commit 86b8c94 into microsoft:v2 Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants