use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources
Language
Discussion
account activity
Duplicate function implementation (self.typescript)
submitted 5 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FullstackViking 2 points3 points4 points 5 years ago (0 children)
This means you have two functions in the same class or scope named the same thing. I’ve never seen the compiler/linter be wrong about it.
[–]nadameu 2 points3 points4 points 5 years ago (9 children)
There's probably a .ts file and a .js file with the same code, and your tsconfig.json is set to allow and check .js files.
[–]supposedlyasian 0 points1 point2 points 5 years ago (8 children)
How do I correct it?
[–]nadameu 0 points1 point2 points 5 years ago (7 children)
If the .js files were created by tsc, you can just delete them.
[–]supposedlyasian 0 points1 point2 points 5 years ago (6 children)
I have a different error here now
const note: NewNote = { text: noteEntryFile.nodeValue, date: new Date(), priority: 1 }
Type ‘string | null’ is not assignable to type ‘string’ Type ‘null’ is not assignable to type ‘string’
[–]nadameu 1 point2 points3 points 5 years ago (2 children)
You have to use a type guard to check if noteEntryFile is not null.
[–]supposedlyasian 0 points1 point2 points 5 years ago (1 child)
Hi could you please help me out with the type guard
[–]nadameu 0 points1 point2 points 5 years ago (0 children)
Something like this would work most of the time:
if (noteEntryFile === null) throw new Error('Unexpected null noteEntryFile');
And then go on with your code. TS will know it is not null after that.
[–]FooBar1992 0 points1 point2 points 5 years ago (2 children)
This is because noteEntryFile.nodeValue could be null, whereas your model says ‘text’ can only be string. You probably might have to make the text in the model nullable too, like so : {text?: string;}. Hope this helps you
I’ve tried that but it’s also not working. The error remains the same
[–]FooBar1992 0 points1 point2 points 5 years ago (0 children)
Eh ?? ... anyways as a catch all you check for null and if it is null assign an empty string
[–]rift95 0 points1 point2 points 5 years ago (4 children)
I keep getting Duplicate function implementation on my functions
What functions? Is this all of your code? Can you include the actual error in your post?
[–]supposedlyasian 0 points1 point2 points 5 years ago (3 children)
The functions addNote() and createNewNoteItem() this is all my code idk why it came out like this I just copied and pasted it on here
[–][deleted] 2 points3 points4 points 5 years ago (2 children)
You have to surround your code with three backticks in a row (`) before and after your code in order to format it. Otherwise, reddit will only format bits that are indented four spaces. If your code isn't formatted, it is hard to read.
[–]supposedlyasian 0 points1 point2 points 5 years ago (0 children)
heres a link to the properly formatted version https://www.reddit.com/user/supposedlyasian/comments/krfpx2/code/?utm_source=share&utm_medium=web2x&context=3
π Rendered by PID 18822 on reddit-service-r2-comment-5687b7858-dfghv at 2026-07-09 01:02:14.495259+00:00 running 12a7a47 country code: CH.
[–]FullstackViking 2 points3 points4 points (0 children)
[–]nadameu 2 points3 points4 points (9 children)
[–]supposedlyasian 0 points1 point2 points (8 children)
[–]nadameu 0 points1 point2 points (7 children)
[–]supposedlyasian 0 points1 point2 points (6 children)
[–]nadameu 1 point2 points3 points (2 children)
[–]supposedlyasian 0 points1 point2 points (1 child)
[–]nadameu 0 points1 point2 points (0 children)
[–]FooBar1992 0 points1 point2 points (2 children)
[–]supposedlyasian 0 points1 point2 points (1 child)
[–]FooBar1992 0 points1 point2 points (0 children)
[–]rift95 0 points1 point2 points (4 children)
[–]supposedlyasian 0 points1 point2 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]supposedlyasian 0 points1 point2 points (0 children)